Fix manifest json ex regression - #516
Merged
Merged
Conversation
squat
commented
Feb 15, 2021
3 similar comments
sbarzowski
approved these changes
Feb 15, 2021
|
|
||
| { | ||
| a: std.manifestJsonEx(a, ' '), | ||
| b: std.manifestJsonEx(b, ' '), |
Contributor
There was a problem hiding this comment.
Let's also add examples of other data types, namely: null, string, number, bool. They all should work.
| // For backwards compatibility reasons, we are manually marshalling to json so we can control formatting | ||
| // In the future, it might be apt to use a library [pretty-printing] function | ||
| func builtinManifestJSONEx(i *interpreter, arguments []value) (value, error) { | ||
| obj, err := i.getObject(arguments[0]) |
Contributor
There was a problem hiding this comment.
Nit: Let's keep it named. value := arguments[0]. This way it's more clear what the args are.
Contributor
Author
There was a problem hiding this comment.
calling it value will shadow the type with the same name, which breaks the funcs that declare parameters of that type inside of the scope of buildinManifestJSONEx.
How about val?
Contributor
There was a problem hiding this comment.
Good point. val sounds good.
This commit fixes a regression in std.manifestJsonEx that caused the standard library function to error when the given value was an array. Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
This commit adds a test case to prevent regressions in std.manifestJsonEx accepting arrays as values. Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
This commit adds test cases for more types to ensure that std.manifestJsonEx continues to work with all types that may be given as the `value` parameter. Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
squat
force-pushed
the
fix_manifestJsonEx_regression
branch
from
February 15, 2021 12:45
0a41545 to
860ee5c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a regression in std.manifestJsonEx that caused the
standard library function to error when the given value was an array.
It also adds a test case to prevent regressions in
std.manifestJsonEx accepting arrays as values.
fixes: #515
Implements fix suggested by @sbarzowski in #515 (comment)