comments
Some checks failed
Build / build (push) Failing after 1m10s
Test / build (push) Failing after 11m40s

This commit is contained in:
Chuck Smith
2024-03-16 19:31:23 -04:00
parent 7463b3af39
commit 83ad72a7fc
7 changed files with 106 additions and 6 deletions

View File

@@ -6,13 +6,15 @@ import (
)
func TestNextToken(t *testing.T) {
input := `let five = 5;
input := `#!./monkey-lang
let five = 5;
let ten = 10;
let add = fn(x, y) {
x + y;
};
# this is a comment
let result = add(five, ten);
!-/*5;
5 < 10 > 5;
@@ -23,6 +25,7 @@ func TestNextToken(t *testing.T) {
return false;
}
// this is another comment
10 == 10;
10 != 9;
"foobar"
@@ -35,6 +38,7 @@ func TestNextToken(t *testing.T) {
expectedType token.TokenType
expectedLiteral string
}{
{token.COMMENT, "!./monkey-lang"},
{token.LET, "let"},
{token.IDENT, "five"},
{token.ASSIGN, "="},
@@ -61,6 +65,7 @@ func TestNextToken(t *testing.T) {
{token.SEMICOLON, ";"},
{token.RBRACE, "}"},
{token.SEMICOLON, ";"},
{token.COMMENT, " this is a comment"},
{token.LET, "let"},
{token.IDENT, "result"},
{token.ASSIGN, "="},
@@ -106,7 +111,7 @@ func TestNextToken(t *testing.T) {
{token.SEMICOLON, ";"},
{token.RBRACE, "}"},
{token.COMMENT, " this is another comment"},
{token.INT, "10"},
{token.EQ, "=="},
{token.INT, "10"},