FORTH-ish interpreter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
prosper/words_test.go

25 lines
377 B

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()
}
}