diff options
author | Charlie Stanton <charlie@shtanton.xyz> | 2023-07-19 11:57:59 +0100 |
---|---|---|
committer | Charlie Stanton <charlie@shtanton.xyz> | 2023-07-19 11:57:59 +0100 |
commit | 8cf10efe3b5a1bcc70bc6e5590ee63fd5eb00c5b (patch) | |
tree | 7a16883c17c2bdcc49b2f9d4f333dfc76c66248f /subex/subexast_test.go | |
parent | 3c34366bdd5d817a184d6b1c901d03a16b6faa4b (diff) | |
download | stred-go-8cf10efe3b5a1bcc70bc6e5590ee63fd5eb00c5b.tar |
Huge refactor to a more value based system, doing away with terminals. Also introduces unit testing
Diffstat (limited to 'subex/subexast_test.go')
-rw-r--r-- | subex/subexast_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/subex/subexast_test.go b/subex/subexast_test.go new file mode 100644 index 0000000..156162e --- /dev/null +++ b/subex/subexast_test.go @@ -0,0 +1,19 @@ +package subex + +import ( + "testing" +) + +func expectASTEqual(t *testing.T, ast SubexAST, expected SubexAST) { + if ast == expected { + return + } + + t.Fatalf("Expected %v, found %v", expected, ast) +} + +func expectAST(t *testing.T, subex string, expected SubexAST) { + lexer := NewStringRuneReader(subex) + ast := Parse(lexer) + expectASTEqual(t, ast, expected) +} |