Add some tests for nested empty arrays

This commit is contained in:
Thomas Pelletier
2013-12-10 17:46:30 +01:00
parent a34fc5f051
commit 01609e0ab7
2 changed files with 21 additions and 0 deletions
+14
View File
@@ -300,6 +300,20 @@ func TestInvalidEsquapeSequence(t *testing.T) {
})
}
func TestNestedArrays(t *testing.T) {
testFlow(t, "foo = [[[]]]", []token{
token{tokenKey, "foo"},
token{tokenEqual, "="},
token{tokenLeftBracket, "["},
token{tokenLeftBracket, "["},
token{tokenLeftBracket, "["},
token{tokenRightBracket, "]"},
token{tokenRightBracket, "]"},
token{tokenRightBracket, "]"},
token{tokenEOF, ""},
})
}
func TestKeyEqualNumber(t *testing.T) {
testFlow(t, "foo = 42", []token{
token{tokenKey, "foo"},
+7
View File
@@ -142,6 +142,13 @@ func TestArrayNested(t *testing.T) {
})
}
func TestNestedEmptyArrays(t *testing.T) {
tree, err := Load("a = [[[]]]")
assertTree(t, tree, err, map[string]interface{}{
"a": [][][]interface{}{[][]interface{}{[]interface{}{}}},
})
}
func TestArrayMixedTypes(t *testing.T) {
_, err := Load("a = [42, 16.0]")
if err.Error() != "mixed types in array" {