summaryrefslogtreecommitdiff
path: root/lexer/lexer_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'lexer/lexer_test.go')
-rw-r--r--lexer/lexer_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/lexer/lexer_test.go b/lexer/lexer_test.go
index 5706209..d89805d 100644
--- a/lexer/lexer_test.go
+++ b/lexer/lexer_test.go
@@ -18,6 +18,12 @@ func TestNextToken(t *testing.T) {
let result = add(five, ten);
!-/*5;
5 < 10 > 5;
+
+ if (5 < 10) {
+ return true;
+ } else {
+ return false;
+ }
`
tests := []struct {
@@ -72,6 +78,23 @@ func TestNextToken(t *testing.T) {
{token.GT, ">"},
{token.INT, "5"},
{token.SEMICOLON, ";"},
+ {token.IF, "if"},
+ {token.LPAREN, "("},
+ {token.INT, "5"},
+ {token.LT, "<"},
+ {token.INT, "10"},
+ {token.RPAREN, ")"},
+ {token.LBRACE, "{"},
+ {token.RETURN, "return"},
+ {token.TRUE, "true"},
+ {token.SEMICOLON, ";"},
+ {token.RBRACE, "}"},
+ {token.ELSE, "else"},
+ {token.LBRACE, "{"},
+ {token.RETURN, "return"},
+ {token.FALSE, "false"},
+ {token.SEMICOLON, ";"},
+ {token.RBRACE, "}"},
{token.EOF, ""},
}