gohcl: don't reflect.DeepEqual number values in tests

big.Float is not DeepEqual-friendly because it contains a precision value
that can make two numerically-equal values appear as non-equal.

Since the number decoding isn't the point of these tests, instead we just
swap out for cty.Bool values which _are_ compatible with
reflect.DeepEqual, since they are just wrappers around the native bool
type.
This commit is contained in:
Martin Atkins 2018-02-27 07:53:20 -08:00
parent 4719b76b52
commit 75cceef4f0
1 changed files with 7 additions and 7 deletions

View File

@ -185,8 +185,8 @@ func TestDecodeBody(t *testing.T) {
},
{
map[string]interface{}{
"name": "Ermintrude",
"age": 51,
"name": "Ermintrude",
"living": true,
},
struct {
Name string `hcl:"name"`
@ -198,7 +198,7 @@ func TestDecodeBody(t *testing.T) {
}{
Name: "Ermintrude",
Remain: map[string]cty.Value{
"age": cty.NumberIntVal(51),
"living": cty.True,
},
}),
0,
@ -509,13 +509,13 @@ func TestDecodeBody(t *testing.T) {
},
{
map[string]interface{}{
"name": "Ermintrude",
"age": 13,
"name": "Ermintrude",
"living": true,
},
map[string]cty.Value(nil),
deepEquals(map[string]cty.Value{
"name": cty.StringVal("Ermintrude"),
"age": cty.NumberIntVal(13),
"name": cty.StringVal("Ermintrude"),
"living": cty.True,
}),
0,
},