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

View File

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