diff options
author | franck cuny <franck@fcuny.net> | 2020-01-11 14:01:49 +0100 |
---|---|---|
committer | franck cuny <franck@fcuny.net> | 2020-01-11 14:17:39 +0100 |
commit | be6ab89f58b0572d0999701d4f1b454e98dec581 (patch) | |
tree | 36acc2238a4f21e604eed6a82c93219607cd75cd | |
parent | Makefile: add a Makefile (diff) | |
download | world-be6ab89f58b0572d0999701d4f1b454e98dec581.tar.gz |
lexer: delete redundant test.
The test `TestNextTokenBasic` was not testing anything that `TestNextTokenMonkey` was not already testing. Rename `TestNextTokenMonkey` to `TestNextToken` for clarity.
-rw-r--r-- | users/fcuny/exp/monkey/pkg/lexer/lexer_test.go | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/users/fcuny/exp/monkey/pkg/lexer/lexer_test.go b/users/fcuny/exp/monkey/pkg/lexer/lexer_test.go index ba7fa07..22dbfcb 100644 --- a/users/fcuny/exp/monkey/pkg/lexer/lexer_test.go +++ b/users/fcuny/exp/monkey/pkg/lexer/lexer_test.go @@ -5,38 +5,7 @@ import ( "testing" ) -func TestNextTokenBasic(t *testing.T) { - input := `=+(){},;` - - tests := []struct { - expectedType token.TokenType - expectedLiteral string - }{ - {token.ASSIGN, "="}, - {token.PLUS, "+"}, - {token.LPAREN, "("}, - {token.RPAREN, ")"}, - {token.LBRACE, "{"}, - {token.RBRACE, "}"}, - {token.COMMA, ","}, - {token.SEMICOLON, ";"}, - } - - l := New(input) - - for i, tt := range tests { - tok := l.NextToken() - if tok.Type != tt.expectedType { - t.Fatalf("tests[%d] - tokentype wrong. expected=%q, got=%q", i, tt.expectedType, tok.Type) - } - - if tok.Literal != tt.expectedLiteral { - t.Fatalf("tests[%d] - tokenliteral wrong. expected=%q, got=%q", i, tt.expectedLiteral, tok.Literal) - } - } -} - -func TestNextTokenMonkey(t *testing.T) { +func TestNextToken(t *testing.T) { input := `let five = 5; let ten = 10; |