-
Notifications
You must be signed in to change notification settings - Fork 0
/
translatable_test.go
44 lines (40 loc) · 877 Bytes
/
translatable_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
package i18n
import (
"testing"
"golang.org/x/text/language"
)
func TestTransFileSize(t *testing.T) {
cases := []struct {
v TransFileSize
ll map[language.Tag]string
}{
{0, map[language.Tag]string{
language.English: "0 bytes",
language.French: "0 octets",
}},
{1, map[language.Tag]string{
language.English: "1 byte",
language.French: "1 octet",
}},
{2, map[language.Tag]string{
language.English: "2 bytes",
language.French: "2 octets",
}},
{1000, map[language.Tag]string{
language.English: "1 kB",
language.French: "1 ko",
}},
{1200000, map[language.Tag]string{
language.English: "1.2 MB",
language.French: "1,2 Mo",
}},
}
for _, c := range cases {
for l, want := range c.ll {
got := c.v.T(l)
if want != got {
t.Errorf("TransFileSize(%v).T(%v): want %v, got %v", c.v, l, want, got)
}
}
}
}