package parser_test import ( "testing" "git.sharkk.net/Sharkk/Mako/parser" ) func TestLiterals(t *testing.T) { tests := []struct { input string expected any }{ {"42", 42.0}, {"3.14", 3.14}, {`"hello"`, "hello"}, {"true", true}, {"false", false}, {"nil", nil}, } for _, tt := range tests { t.Run(tt.input, func(t *testing.T) { l := parser.NewLexer(tt.input) p := parser.NewParser(l) expr := p.ParseExpression(parser.LOWEST) checkParserErrors(t, p) switch expected := tt.expected.(type) { case float64: testNumberLiteral(t, expr, expected) case string: testStringLiteral(t, expr, expected) case bool: testBooleanLiteral(t, expr, expected) case nil: testNilLiteral(t, expr) } }) } }