Add some tests for nested empty arrays
This commit is contained in:
@@ -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"},
|
||||
|
||||
@@ -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" {
|
||||
|
||||
Reference in New Issue
Block a user