textmachine/backend/internal/lang/script_test.go

26 lines
1.1 KiB
Go

package lang
import "testing"
// TestSecondPairDryRun is the §5 "second pair" dry-run for the source-script seam (П2): the echo detector
// must be REACHABLE for every source the engine handles — a source with no declared script silently sleeps
// the echo detector (the en/ko blind spots §5 named). Every 2nd-pair source declares a script here.
func TestSecondPairDryRun(t *testing.T) {
for _, tc := range []struct {
lang string
isCJK bool
}{
{"zh", true}, {"ja", true}, {"ko", true}, {"en", false}, {"ru", false},
} {
if got := LangScripts(tc.lang); len(got) == 0 {
t.Errorf("LangScripts(%q) is empty — the echo detector would sleep silently for this source (a §5 blind spot)", tc.lang)
}
if got := IsCJKScriptLang(tc.lang); got != tc.isCJK {
t.Errorf("IsCJKScriptLang(%q) = %v, want %v", tc.lang, got, tc.isCJK)
}
}
// ko (Hangul) and en (Latin) are the two the OLD hard-coded Han+kana detector was blind to.
if len(LangScripts("ko")) == 0 || len(LangScripts("en")) == 0 {
t.Fatal("ko/en must resolve scripts — these are the fixed blind spots")
}
}