-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathplural_test.tmpl
More file actions
35 lines (32 loc) · 959 Bytes
/
plural_test.tmpl
File metadata and controls
35 lines (32 loc) · 959 Bytes
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
// Generated by https://github.com/gotnospirit/makeplural
// at {{ .Timestamp }}
{{ .Headers }}
package plural
import (
"fmt"
"testing"
)
func getPluralFunc(t *testing.T, culture string) func(interface{}, bool) string {
result, err := GetFunc(culture)
if nil != err {
t.Errorf("Unexpected error: %s", err.Error())
return nil
}
return result
}
func testNamedKey(t *testing.T, fn func(interface{}, bool) string, input interface{}, expected, name string, ordinal bool) {
result := fn(input, ordinal)
if result != expected {
t.Errorf("`%s` expecting <%v> but got <%v>", name, expected, result)
} else if testing.Verbose() {
fmt.Printf("- Got expected result <%s> for `%v`\n", result, input)
}
}
{{ range $_, $item := .Items }}
func TestPluralFunc_{{ $item.CultureId }}(t *testing.T) {
fn := getPluralFunc(t, "{{ $item.Culture }}")
if nil != fn {
{{ $item.Code }}
}
}
{{ end }}