Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hclwrite: Fix incorrect test TestTokenGenerateConsistency
This test is aiming to verify that the tokens produced by TokensForValue when given a map or object value will stay consistent with the tokens produced by the lower-level TokensForObject function under future maintenence. However, since cty object types and maps don't preserve attribute/element order, the result from TokensFromValue is always a lexical sort of the attribute names or keys. TokensForObject is intentionally more flexible by allowing the caller to control the order of the generated attributes, but that means that we expect consistency only if the caller provides the attributes in lexical order. This test therefore now provides the TokensForObject argument in the expected order to make this test valid. Previously one of the test cases would fail 50% of the time due to the attributes being written out in reverse order.
- Loading branch information