mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-12-06 10:47:38 +02:00
36 lines
553 B
Go
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))
|
|
}
|
|
}
|