restructure project
This commit is contained in:
30
internal/ast/ast_test.go
Normal file
30
internal/ast/ast_test.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package ast
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"monkey/internal/token"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestString(t *testing.T) {
|
||||
program := &Program{
|
||||
Statements: []Statement{
|
||||
&ExpressionStatement{
|
||||
Token: token.Token{Type: token.IDENT, Literal: "myVar"},
|
||||
Expression: &BindExpression{
|
||||
Token: token.Token{Type: token.BIND, Literal: ":="},
|
||||
Left: &Identifier{
|
||||
Token: token.Token{Type: token.IDENT, Literal: "myVar"},
|
||||
Value: "myVar",
|
||||
},
|
||||
Value: &Identifier{
|
||||
Token: token.Token{Type: token.IDENT, Literal: "anotherVar"},
|
||||
Value: "anotherVar",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
assert.Equal(t, "myVar:=anotherVar", program.String())
|
||||
}
|
||||
Reference in New Issue
Block a user