Files
artex/server/skill_zip_localized_test.go
T
dela 97668dab7e
ci / go (push) Waiting to run
ci / go-db (agent) (push) Waiting to run
ci / go-db (config) (push) Waiting to run
ci / go-db (db) (push) Waiting to run
ci / go-db (evidence) (push) Waiting to run
ci / go-db (llmrec) (push) Waiting to run
ci / go-db (server) (push) Waiting to run
detections / detections (push) Waiting to run
docs / links (push) Waiting to run
web / web (push) Waiting to run
Localize user-facing UI, agent output, and backend messages to Simplified Chinese
2026-10-09 14:08:31 +08:00

45 lines
1.7 KiB
Go

package server
import (
"fmt"
"strings"
"testing"
"unicode"
)
// TestSkillZipErrorsLocalized guards the F3b skill_zip.go bundle: every user-facing
// skill-upload error response (fsUploadSkill surfaces these via
// writeErr(400, err.Error()), see server_mgmt.go) must be Korean, and no zip-method
// display name may stay Chinese. Reverting any of these literals to Chinese fails here.
func TestSkillZipErrorsLocalized(t *testing.T) {
// Message constants rendered with sample arguments.
assertChineseError(t, "errSkillZipParse",
fmt.Errorf(errSkillZipParse, fmt.Errorf("boom")).Error())
assertChineseError(t, "errSkillZipEncrypted",
fmt.Sprintf(errSkillZipEncrypted, "demo/SKILL.md"))
assertChineseError(t, "errSkillZipUnsupported",
fmt.Sprintf(errSkillZipUnsupported, "LZMA", 14, "demo/SKILL.md"))
// A non-zip upload must reach the user as a Korean hint, not a raw stdlib error.
if _, err := newSkillZipReader([]byte("this is not a zip archive")); err == nil {
t.Fatal("비-zip 입력은 오류를 반환해야 합니다")
} else {
assertChineseError(t, "newSkillZipReader", err.Error())
if !strings.Contains(err.Error(), "压缩文件") {
t.Fatalf("parse error = %q, want '压缩文件' 안내", err.Error())
}
}
// No zip-method display name may carry a Chinese Han ideograph; the two
// translated ones (AES, unknown fallback) must be Korean.
for m, name := range zipMethodNames {
for _, r := range name {
if unicode.Is(unicode.Hangul, r) {
t.Fatalf("zipMethodNames[%d] = %q 에 한글이 남아 있습니다", m, name)
}
}
}
assertChineseError(t, "zipMethodName(AES)", zipMethodName(zipMethodAES))
assertChineseError(t, "zipMethodName(unknown)", zipMethodName(0xffff))
}