diff options
author | Alexander Kiryukhin <a.kiryukhin@corp.mail.ru> | 2018-05-10 03:03:55 +0300 |
---|---|---|
committer | Alexander Kiryukhin <a.kiryukhin@corp.mail.ru> | 2018-05-10 03:14:06 +0300 |
commit | cf07a154d56f87d34568c44c9c28367985a9e935 (patch) | |
tree | 6a8d5653ea55abee1f7890245f450c5649d38c0a /stemmer_test.go | |
parent | 6796db17de2374cb3120287ebeb0b6a02d0b8089 (diff) |
Move filesv1
Added travis.yml
Diffstat (limited to 'stemmer_test.go')
-rw-r--r-- | stemmer_test.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/stemmer_test.go b/stemmer_test.go new file mode 100644 index 0000000..8b27774 --- /dev/null +++ b/stemmer_test.go @@ -0,0 +1,27 @@ +package StemmerRu + +import ( + "testing" + "io/ioutil" + "encoding/json" +) + +var testFile = `tests.json` + +func TestStemWord(t *testing.T) { + file, err := ioutil.ReadFile(testFile) + if err != nil { + t.Error("Can't open file", testFile) + } + tests := &map[string]string{} + err = json.Unmarshal(file, tests) + if err != nil { + t.Error("Can't parse json", err) + } + for source, expected := range *tests { + result := StemWord(source); + if expected != result { + t.Errorf(`Expected "%s" (source: %s) but got "%s"`, result, source, result) + } + } +} |