diff --git a/lexer_test.go b/lexer_test.go index b7de9f5..1d7e37b 100644 --- a/lexer_test.go +++ b/lexer_test.go @@ -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"}, diff --git a/parser_test.go b/parser_test.go index 9beef36..9108bab 100644 --- a/parser_test.go +++ b/parser_test.go @@ -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" {