tomltest: unmarshal JSONs for tests (#633)
Comparing the output and the expected results byte-wise means we get false negative when order doesn't matter (for example the ValidTableKeyword test).
This commit is contained in:
@@ -41,5 +41,14 @@ func testgenValid(t *testing.T, input string, jsonRef string) {
|
|||||||
}
|
}
|
||||||
j, err := testsuite.ValueToTaggedJSON(doc)
|
j, err := testsuite.ValueToTaggedJSON(doc)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, jsonRef, string(j)+"\n")
|
|
||||||
|
var ref interface{}
|
||||||
|
err = json.Unmarshal([]byte(jsonRef), &ref)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
var actual interface{}
|
||||||
|
err = json.Unmarshal([]byte(j), &actual)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
require.Equal(t, ref, actual)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1492,7 +1492,6 @@ func TestTOMLTest_Valid_Table_Empty(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestTOMLTest_Valid_Table_Keyword(t *testing.T) {
|
func TestTOMLTest_Valid_Table_Keyword(t *testing.T) {
|
||||||
t.Skip("FIXME")
|
|
||||||
input := "[true]\n\n[false]\n\n[inf]\n\n[nan]\n\n\n"
|
input := "[true]\n\n[false]\n\n[inf]\n\n[nan]\n\n\n"
|
||||||
jsonRef := "{\n \"true\": {},\n \"false\": {},\n \"inf\": {},\n \"nan\": {}\n}\n"
|
jsonRef := "{\n \"true\": {},\n \"false\": {},\n \"inf\": {},\n \"nan\": {}\n}\n"
|
||||||
testgenValid(t, input, jsonRef)
|
testgenValid(t, input, jsonRef)
|
||||||
|
|||||||
Reference in New Issue
Block a user