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:
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
@@ -18,6 +19,7 @@ import (
|
||||
"git.golem15.com/golem15/summercms/phrasebook"
|
||||
"git.golem15.com/golem15/summercms/postcard"
|
||||
"git.golem15.com/golem15/summercms/surf"
|
||||
"git.golem15.com/golem15/summercms/towel"
|
||||
)
|
||||
|
||||
func TestGreeterHelloPrintsLayeredConfig(t *testing.T) {
|
||||
@@ -122,6 +124,13 @@ func TestHelloPluginResolvesLang(t *testing.T) {
|
||||
if !ok {
|
||||
t.Fatal("translator not published")
|
||||
}
|
||||
ctx := towel.WithLocale(context.Background(), "pl")
|
||||
if got := tr.Get(ctx, "golem15.hello::lang.greeting", nil); got != "Cześć" {
|
||||
t.Fatalf("towel locale = %q", got)
|
||||
}
|
||||
if got := tr.Get(context.Background(), "golem15.hello::lang.greeting", nil); got != "Hello" {
|
||||
t.Fatalf("app locale default = %q", got)
|
||||
}
|
||||
if got := tr.GetIn("en", "golem15.hello::lang.labels.pluginName", nil); got != "Hello plugin" {
|
||||
t.Fatalf("en = %q", got)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user