package parser_test import ( "testing" ) func TestKeyWithoutAssignment(t *testing.T) { err := "unexpected end of file (expected a value assignment)" runStatesTs(t, []statesT{ {"bare with whitespace", " a ", "[a]", "unexpected character ' ' (expected a value assignment)"}, {"bare lower", "abcdefghijklmnopqrstuvwxyz", "[abcdefghijklmnopqrstuvwxyz]", err}, {"bare upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "[ABCDEFGHIJKLMNOPQRSTUVWXYZ]", err}, {"bare numbers", "0123456789", "[0123456789]", err}, {"bare underscore", "_", "[_]", err}, {"bare dash", "-", "[-]", err}, {"bare big mix", "-hey_good_Lookin123-", "[-hey_good_Lookin123-]", err}, }) } func TestDottedKey(t *testing.T) { runStatesTs(t, []statesT{ {"bare dotted", "a._.c", "[a].[_].[c]", "unexpected end of file (expected a value assignment)"}, {"bare dotted with whitespace", " a .\t\t b\t ", "[a].[b]", `unexpected character '\t' (expected a value assignment)`}, }) } func TestKeyWithAssignmentButNoValue(t *testing.T) { err := "unexpected end of file (expected a value)" runStatesTs(t, []statesT{ {"bare", "a=", "[a]=", err}, {"double equal sign", "a==", "[a]=", "unexpected character '=' (expected a value)"}, {"bare dotted", "a.b=", "[a].[b]=", err}, {"bare dotted with whitespace", " a .\tb\t = ", "[a].[b]=", err}, }) }