git-svn-id: https://svn.tlawal.org/svn/monkey@8 f6afcba9-9ef1-4bdd-9b72-7484f5705bac
This commit is contained in:
parent
cf651aa1b8
commit
0aa17eeee4
@ -1,9 +1,9 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"monkey/ast"
|
||||
"monkey/lexer"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestLetStatement(t *testing.T) {
|
||||
@ -13,7 +13,7 @@ func TestLetStatement(t *testing.T) {
|
||||
let foobar = 878688;
|
||||
`
|
||||
l_lexer := lexer.New(input)
|
||||
l_parser = New(l_lexer)
|
||||
l_parser := New(l_lexer)
|
||||
|
||||
program := l_parser.ParseProgram()
|
||||
if program == nil {
|
||||
@ -24,7 +24,7 @@ func TestLetStatement(t *testing.T) {
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
expetedIdentifier string
|
||||
expectedIdentifier string
|
||||
}{
|
||||
{"x"},
|
||||
{"y"},
|
||||
@ -57,7 +57,8 @@ func testLetStatement(t *testing.T, s ast.Statement, name string) bool {
|
||||
}
|
||||
|
||||
if letStmt.Name.TokenLiteral() != name {
|
||||
e.Errorf("letStmt.Name.TokenLiteral() not '%s', got=%s", name, letStmt.Name.TokenLiteral())
|
||||
t.Errorf("letStmt.Name.TokenLiteral() not '%s', got=%s", name, letStmt.Name.TokenLiteral())
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user