summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/nicksnyder/go-i18n/i18n/language/plural_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/nicksnyder/go-i18n/i18n/language/plural_test.go')
-rw-r--r--vendor/github.com/nicksnyder/go-i18n/i18n/language/plural_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/github.com/nicksnyder/go-i18n/i18n/language/plural_test.go b/vendor/github.com/nicksnyder/go-i18n/i18n/language/plural_test.go
new file mode 100644
index 000000000..6336d29b2
--- /dev/null
+++ b/vendor/github.com/nicksnyder/go-i18n/i18n/language/plural_test.go
@@ -0,0 +1,28 @@
+package language
+
+import (
+ "testing"
+)
+
+func TestNewPlural(t *testing.T) {
+ tests := []struct {
+ src string
+ plural Plural
+ err bool
+ }{
+ {"zero", Zero, false},
+ {"one", One, false},
+ {"two", Two, false},
+ {"few", Few, false},
+ {"many", Many, false},
+ {"other", Other, false},
+ {"asdf", Invalid, true},
+ }
+ for _, test := range tests {
+ plural, err := NewPlural(test.src)
+ wrongErr := (err != nil && !test.err) || (err == nil && test.err)
+ if plural != test.plural || wrongErr {
+ t.Errorf("NewPlural(%#v) returned %#v,%#v; expected %#v", test.src, plural, err, test.plural)
+ }
+ }
+}