1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-04 10:34:55 +02:00
lazygit/pkg/i18n/i18n_test.go

36 lines
553 B
Go
Raw Normal View History

2018-08-20 08:53:13 +02:00
package i18n
import (
"fmt"
2018-08-20 08:53:13 +02:00
"testing"
"github.com/stretchr/testify/assert"
)
2018-11-30 02:47:14 +02:00
// TestDetectLanguage is a function.
func TestDetectLanguage(t *testing.T) {
2018-08-20 08:53:13 +02:00
type scenario struct {
langDetector func() (string, error)
expected string
2018-08-20 08:53:13 +02:00
}
scenarios := []scenario{
{
func() (string, error) {
return "", fmt.Errorf("An error occurred")
2018-08-20 08:53:13 +02:00
},
"C",
2018-08-20 08:53:13 +02:00
},
{
func() (string, error) {
return "en", nil
2018-08-20 08:53:13 +02:00
},
"en",
},
}
for _, s := range scenarios {
assert.EqualValues(t, s.expected, detectLanguage(s.langDetector))
}
}