test(04-04): close translation lookup and catalog boundary coverage
- Cover nested groups, malformed paths, invalid pipes, and compass locale - Name plugin, file, and key on activation catalog failures - Prove hello activation reads the translator through towel.WithLocale Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -457,6 +457,26 @@ func TestActivateMalformedLangFailsWithPluginContext(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestActivateMalformedLangLeafNamesFileAndKey(t *testing.T) {
|
||||
p := &langPlugin{
|
||||
id: "golem15.hello",
|
||||
fsys: fstest.MapFS{
|
||||
"lang/en/lang.yaml": {Data: []byte("labels:\n count: 1\n")},
|
||||
},
|
||||
}
|
||||
app := backpack.New(&compass.Config{})
|
||||
_, err := activate([]Plugin{p}, app, []string{"golem15.hello"})
|
||||
if err == nil {
|
||||
t.Fatal("expected non-string leaf error")
|
||||
}
|
||||
msg := err.Error()
|
||||
for _, want := range []string{"golem15.hello", "lang/en/lang.yaml", "labels.count", "non-string leaf"} {
|
||||
if !strings.Contains(msg, want) {
|
||||
t.Fatalf("error %q missing %s", msg, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type mailPlugin struct {
|
||||
id string
|
||||
fsys fs.FS
|
||||
|
||||
Reference in New Issue
Block a user