Added cj & jyutping lookup
This commit is contained in:
45
datasources/cjlookup/query_test.go
Normal file
45
datasources/cjlookup/query_test.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package cjlookup
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestQuery(t *testing.T) {
|
||||
qo := Query("zh-Hant", "jp jyut6")
|
||||
mesg, err := qo.Message()
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected Error: %s", err)
|
||||
}
|
||||
|
||||
if !strings.Contains(mesg, "粵42") {
|
||||
t.Errorf("Expected 粵42 in response, got \"%s\" instead", mesg)
|
||||
}
|
||||
|
||||
qo = Query("zh-Hant", "jp jyut6")
|
||||
mesg, err = qo.Message()
|
||||
if !strings.Contains(mesg, "粵42") {
|
||||
t.Errorf("Expected 粵42 in response, got \"%s\" instead", mesg)
|
||||
}
|
||||
|
||||
qo = Query("zh-Hant", "NaN")
|
||||
mesg, err = qo.Message()
|
||||
if err == nil {
|
||||
t.Errorf("Expecting error, got \"%s\" instead", mesg)
|
||||
}
|
||||
|
||||
qo = Query("zh-Hant", "jp 粵")
|
||||
mesg, err = qo.Message()
|
||||
if !strings.Contains(mesg, "閲62") {
|
||||
t.Errorf("Expected 閲62 in response, got \"%s\" instead", mesg)
|
||||
}
|
||||
|
||||
qo = Query("zh-Hant", "jp 粵 62")
|
||||
mesg, err = qo.Message()
|
||||
if !strings.Contains(mesg, "閲62") {
|
||||
t.Errorf("Expected 閲62 in response, got \"%s\" instead", mesg)
|
||||
}
|
||||
|
||||
fmt.Println(mesg)
|
||||
}
|
||||
Reference in New Issue
Block a user