prosper/words_test.go

23 lines
345 B
Go

package main
import "testing"
func TestDictionary(t *testing.T) {
d := Dictionary{}
d.AddWord("INC", nil, []string{"1", "+"})
w, err := d.GetWord("INC")
if err != nil {
t.Fail()
}
if w.Name != "INC" {
t.Fail()
}
if w.Impl != nil {
t.Fail()
}
if len(w.Source) != 2 || w.Source[0] != "1" || w.Source[1] != "+" {
t.Fail()
}
}