-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix manifest json ex regression #516
Fix manifest json ex regression #516
Conversation
3 similar comments
{ | ||
a: std.manifestJsonEx(a, ' '), | ||
b: std.manifestJsonEx(b, ' '), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also add examples of other data types, namely: null, string, number, bool. They all should work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds great 👍
@@ -1211,11 +1211,6 @@ func jsonEncode(v interface{}) (string, error) { | |||
// 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]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Let's keep it named. value := arguments[0]
. This way it's more clear what the args are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>
0a41545
to
860ee5c
Compare
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)