MCPcopy
hub / github.com/kubernetes/kubectl / TestTranslationPlural

Function TestTranslationPlural

pkg/util/i18n/i18n_test.go:41–56  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

39}
40
41func TestTranslationPlural(t *testing.T) {
42 err := LoadTranslations("test", func() string { return "default" })
43 if err != nil {
44 t.Errorf("Unexpected error: %v", err)
45 }
46
47 result := T("test_plural", 3)
48 if result != "there were 3 items" {
49 t.Errorf("expected: %s, saw: %s", "there were 3 items", result)
50 }
51
52 result = T("test_plural", 1)
53 if result != "there was 1 item" {
54 t.Errorf("expected: %s, saw: %s", "there was 1 item", result)
55 }
56}
57
58func TestTranslationUsingEnvVar(t *testing.T) {
59 // We must backup and restore env vars before setting test values in tests

Callers

nothing calls this directly

Calls 2

LoadTranslationsFunction · 0.85
TFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…