prosper/words_test.go

26 lines
377 B
Go

package main
import "testing"
func TestDictionary(t *testing.T) {
d := Dictionary{}
d.AddWord("INC", Word{
Name: "INC",
Source: []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()
}
}