package ast import ( "testing" "code.osinet.fr/fgm/waiig15/token" ) func TestString(t *testing.T) { // Build a program made of a single "let myBra = anotherVar;" statement. program := &Program{ Statements: []Statement{ &LetStatement{ Token: token.Token{ Type: token.LET, Literal: "let", }, Name: &Identifier{ Token: token.Token{ Type: token.IDENT, Literal: "myVar", }, Value: "myVar", }, Value: &Identifier{ Token: token.Token{ Type: token.IDENT, Literal: "anotherVar", }, Value: "anotherVar", }, }, }, } programString := program.String() if programString != "let myVar = anotherVar;" { t.Errorf("program.String() wrong, got=%q", programString) } }