-
Notifications
You must be signed in to change notification settings - Fork 15
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
Template functions returning slices should have deterministic order #29
Comments
Crevil
added a commit
that referenced
this issue
Feb 8, 2019
Template function objectArray did not order values deterministic. This changes ensures this by ordering after all values are parsed. The test assertion is changed to `assert.Equal` that matches the values directly instead of `assert.ElementsMatch` that does not take order into account. With this change the "nil input" test case did not match expectatations. This is due to `assert.ElementsMatch` accepting a nil value to match an empty slice. This means the output of the function have not changed, but our assertion has gotten more strict. Related to #29
Crevil
added a commit
that referenced
this issue
Feb 8, 2019
Template function 'getFiles' did not order files deterministic. This change ensures this by ordering all files by name. Related to #29
Crevil
added a commit
that referenced
this issue
Feb 8, 2019
Template function array did not order values deterministic. This change ensures this for string arrays. We have no trivial way of ordering unknown types so this is omitted. I removed some code handling objects in the input. The function is not intended to handle these cases. TmplObjectArray should be used instead. Related to #29
kaspernissen
pushed a commit
that referenced
this issue
Feb 12, 2019
* Deterministic order of TmplObjectArray function Template function objectArray did not order values deterministic. This changes ensures this by ordering after all values are parsed. The test assertion is changed to `assert.Equal` that matches the values directly instead of `assert.ElementsMatch` that does not take order into account. With this change the "nil input" test case did not match expectatations. This is due to `assert.ElementsMatch` accepting a nil value to match an empty slice. This means the output of the function have not changed, but our assertion has gotten more strict. Related to #29 * Deterministic order of TmplGetFiles function Template function 'getFiles' did not order files deterministic. This change ensures this by ordering all files by name. Related to #29 * Deterministic order of TmplArray function Template function array did not order values deterministic. This change ensures this for string arrays. We have no trivial way of ordering unknown types so this is omitted. I removed some code handling objects in the input. The function is not intended to handle these cases. TmplObjectArray should be used instead. Related to #29
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When generating templates using the following template functions, the order of the values are not deterministic.
TmplObjectArray
TmplGetFiles
TmplArray
This becomes clear when the results of tempalted files are committed where the different order will indicates changes of (properly) non-functional changes.
The text was updated successfully, but these errors were encountered: