add and fix tests
This commit is contained in:
24
cmd/any2anexoj-cli/localizer_test.go
Normal file
24
cmd/any2anexoj-cli/localizer_test.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestNewLocalizer(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
lang string
|
||||
}{
|
||||
{"english", "en"},
|
||||
{"portuguese", "pt"},
|
||||
{"english with region", "en-US"},
|
||||
{"portuguese with region", "pt-BR"},
|
||||
{"unknown language falls back to default", "!!"},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
_, err := NewLocalizer(tt.lang)
|
||||
if err != nil {
|
||||
t.Fatalf("want success call but failed: %v", err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user