Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ikawaha committed Mar 19, 2016
1 parent f9542e9 commit 5e80a7c
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tokenizer/udic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,42 @@ func TestNewUserDicRecords02(t *testing.T) {

}

func TestNewUserDicRecords03(t *testing.T) {
r := UserDicRecords{
{
Text: "日本経済新聞",
Tokens: []string{"日本", "経済", "新聞"},
Yomi: []string{"ニホン", "ケイザイ"},
Pos: "カスタム名詞",
},
}
_, err := r.NewUserDic()
if err == nil {
t.Errorf("expected error, but nil")
}
}

func TestNewUserDicRecords04(t *testing.T) {
r := UserDicRecords{
{
Text: "日本経済新聞",
Tokens: []string{"日本", "経済", "新聞"},
Yomi: []string{"ニホン", "ケイザイ", "シンブン"},
Pos: "カスタム名詞",
},
{
Text: "日本経済新聞",
Tokens: []string{"日本", "経済", "新聞"},
Yomi: []string{"ニホン", "ケイザイ", "シンブン"},
Pos: "カスタム名詞",
},
}
_, err := r.NewUserDic()
if err == nil {
t.Errorf("expected error, but nil")
}
}

func TestUserDicRecordsLoadFromJSON(t *testing.T) {
var rec UserDicRecords
_ = json.Unmarshal([]byte(`[
Expand Down

0 comments on commit 5e80a7c

Please sign in to comment.