comments
This commit is contained in:
@@ -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"},
|
||||
|
||||
Reference in New Issue
Block a user