You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

33 lines
1.1 KiB

package echomeet
import (
"strings"
"testing"
)
// 客户端「自动 / 不翻译」的两种写法都要归一成空串
func TestNormalizeAutoLang(t *testing.T) {
for in, want := range map[string]string{"": "", "auto": "", " AUTO ": "", "en-US": "en-US"} {
if got := normalizeAutoLang(in); got != want {
t.Errorf("normalizeAutoLang(%q)=%q want %q", in, got, want)
}
}
}
// 不翻译 → 跟随转写语言;翻译 → 点名目标语种。两者绝不能混:
// 不翻译时若写出了某个具体语种,英文录音会被总结成中文。
func TestSummaryLanguageInstruction(t *testing.T) {
for _, to := range []string{"", "auto"} {
got := summaryLanguageInstruction(to)
if !strings.Contains(got, "same language as the transcript") {
t.Errorf("to=%q 应跟随转写语言,得到 %q", to, got)
}
}
got := summaryLanguageInstruction("ja-JP")
if !strings.Contains(got, "Japanese (ja-JP)") {
t.Errorf("ja-JP 应点名日语,得到 %q", got)
}
if got := summaryLanguageInstruction("xx-YY"); !strings.Contains(got, "xx-YY") {
t.Errorf("表外语种应原样写码,得到 %q", got)
}
}