about summary refs log tree commit diff
path: root/users/fcuny
diff options
context:
space:
mode:
Diffstat (limited to 'users/fcuny')
-rw-r--r--users/fcuny/exp/monkey/pkg/lexer/lexer_test.go28
1 files changed, 25 insertions, 3 deletions
diff --git a/users/fcuny/exp/monkey/pkg/lexer/lexer_test.go b/users/fcuny/exp/monkey/pkg/lexer/lexer_test.go
index 22dbfcb..df1b392 100644
--- a/users/fcuny/exp/monkey/pkg/lexer/lexer_test.go
+++ b/users/fcuny/exp/monkey/pkg/lexer/lexer_test.go
@@ -15,7 +15,13 @@ let add = fn(x, y) {
 
 let result = add(five, ten);
 !-/*5;
-5 < 10 > 5;
+10 > 5;
+
+if (5 < 10) {
+  return true;
+} else {
+  return false;
+}
 `
 
 	tests := []struct {
@@ -68,12 +74,28 @@ let result = add(five, ten);
 		{token.INT, "5"},
 		{token.SEMICOLON, ";"},
 
-		{token.INT, "5"},
-		{token.LT, "<"},
 		{token.INT, "10"},
 		{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, "}"},
 	}
 
 	l := New(input)