Skip to content

Commit

Permalink
fix(translate): Serbian expected translation (#4251)
Browse files Browse the repository at this point in the history
  • Loading branch information
Deleplace authored Jul 18, 2024
1 parent 34d1df2 commit fa24a26
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions translate/v3/translate_text_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
)

func TestTranslateText(t *testing.T) {
t.Skip("Skipped while investigating https://github.com/GoogleCloudPlatform/golang-samples/issues/2811")
tc := testutil.SystemTest(t)

sourceLang := "en-US"
Expand All @@ -35,7 +34,15 @@ func TestTranslateText(t *testing.T) {
if err := translateText(&buf, tc.ProjectID, sourceLang, targetLang, text); err != nil {
t.Fatalf("translateText: %v", err)
}
if got, want1, want2 := buf.String(), "Zdravo", "Pozdrav"; !strings.Contains(got, want1) && !strings.Contains(got, want2) {
t.Errorf("translateText got:\n----\n%s----\nWant to contain:\n----\n%s\n----\nOR\n----\n%s\n----", got, want1, want2)
// Acceptable answers look like:
// "Zdravo Svete"
// "Здраво Свете"
lower := strings.ToLower(buf.String())
ok := strings.Contains(lower, "zdravo") ||
strings.Contains(lower, "svete") ||
strings.Contains(lower, "здраво") ||
strings.Contains(lower, "свете")
if got, want1, want2 := buf.String(), "Zdravo Svete", "Здраво Свете"; !ok {
t.Errorf("translateText got:\n----\n%s----\nWant:\n----\n%s\n----\nOR\n----\n%s\n----", got, want1, want2)
}
}

0 comments on commit fa24a26

Please sign in to comment.