1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-06 10:47:38 +02:00
lazygit/pkg/i18n/i18n_test.go
2020-11-18 08:36:19 +11:00

36 lines
553 B
Go

package i18n
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
// TestDetectLanguage is a function.
func TestDetectLanguage(t *testing.T) {
type scenario struct {
langDetector func() (string, error)
expected string
}
scenarios := []scenario{
{
func() (string, error) {
return "", fmt.Errorf("An error occurred")
},
"C",
},
{
func() (string, error) {
return "en", nil
},
"en",
},
}
for _, s := range scenarios {
assert.EqualValues(t, s.expected, detectLanguage(s.langDetector))
}
}