24 lines
568 B
Go
24 lines
568 B
Go
|
|
package i18n
|
||
|
|
|
||
|
|
import "testing"
|
||
|
|
|
||
|
|
func TestDetect(t *testing.T) {
|
||
|
|
cases := []struct {
|
||
|
|
in, want string
|
||
|
|
}{
|
||
|
|
{"Hola, ¿qué proyectos tienes?", "es"},
|
||
|
|
{"háblame de rony-llm-agent", "es"},
|
||
|
|
{"¿cuáles son tus skills?", "es"},
|
||
|
|
{"What projects do you have?", "en"},
|
||
|
|
{"Tell me about rony-llm-agent", "en"},
|
||
|
|
{"How does the chat bot work?", "en"},
|
||
|
|
{"lorem ipsum dolor sit amet", "en"}, // no markers → en
|
||
|
|
{"", "en"},
|
||
|
|
}
|
||
|
|
for _, c := range cases {
|
||
|
|
got := Detect(c.in)
|
||
|
|
if got != c.want {
|
||
|
|
t.Errorf("Detect(%q) = %q, want %q", c.in, got, c.want)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|