-
Notifications
You must be signed in to change notification settings - Fork 0
/
mixed_test.go
53 lines (48 loc) · 860 Bytes
/
mixed_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package wanakana_test
import (
"testing"
"github.com/deelawn/wanakana"
)
func TestIsMixed(t *testing.T) {
var tests = []struct {
name string
input string
passKanji bool
expected bool
}{
{
name: "empty string",
},
{
name: "mixed scripts no kanji",
input: "Abあア",
expected: true,
},
{
name: "mixed scripts with kanji",
input: "お腹A",
passKanji: true,
expected: true,
},
{
name: "mixed scripts with kanji no pass",
input: "お腹A",
},
{
name: "latin only",
input: "ab",
},
{
name: "kana only",
input: "あア",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
actual := wanakana.IsMixed(tt.input, tt.passKanji)
if actual != tt.expected {
t.Errorf("expected %v, actual %v", tt.expected, actual)
}
})
}
}