Skip to content

Commit

Permalink
Merge pull request #42 from neolit123/1.20-fix-tests-on-arm64
Browse files Browse the repository at this point in the history
yaml_test: adapt around undefined behavior in float64->int64 casting
  • Loading branch information
k8s-ci-robot committed Jan 24, 2021
2 parents 8aabd9a + 7e97a1a commit 8f01418
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions yaml_test.go
Expand Up @@ -428,6 +428,7 @@ foo: baz
}

func TestJSONObjectToYAMLObject(t *testing.T) {
const bigUint64 = ((uint64(1) << 63) + 500) / 1000 * 1000
intOrInt64 := func(i64 int64) interface{} {
if i := int(i64); i64 == int64(i) {
return i
Expand Down Expand Up @@ -459,7 +460,7 @@ func TestJSONObjectToYAMLObject(t *testing.T) {
"map": map[string]interface{}{"foo": "bar"},
"slice": []interface{}{"foo", "bar"},
"string": string("foo"),
"uint64 big": float64(math.Pow(2, 63)),
"uint64 big": bigUint64,
},
expected: yaml.MapSlice{
{Key: "nil slice"},
Expand All @@ -476,7 +477,7 @@ func TestJSONObjectToYAMLObject(t *testing.T) {
{Key: "map", Value: yaml.MapSlice{{Key: "foo", Value: "bar"}}},
{Key: "slice", Value: []interface{}{"foo", "bar"}},
{Key: "string", Value: string("foo")},
{Key: "uint64 big", Value: uint64(1) << 63},
{Key: "uint64 big", Value: bigUint64},
},
},
}
Expand Down

0 comments on commit 8f01418

Please sign in to comment.