[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/i18n/RFC.md fully. Find ONE feature... #122
2 changed files with 27 additions and 0 deletions
|
|
@ -843,6 +843,7 @@ func TemplateFuncs() template.FuncMap {
|
|||
"title": Title,
|
||||
"lower": Lower,
|
||||
"upper": Upper,
|
||||
"n": N,
|
||||
"past": PastTense,
|
||||
"gerund": Gerund,
|
||||
"plural": Pluralize,
|
||||
|
|
|
|||
|
|
@ -1001,6 +1001,7 @@ func TestTemplateFuncs(t *testing.T) {
|
|||
"title",
|
||||
"lower",
|
||||
"upper",
|
||||
"n",
|
||||
"past",
|
||||
"gerund",
|
||||
"plural",
|
||||
|
|
@ -1089,6 +1090,31 @@ func TestTemplateFuncs_PromptAndLang(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestTemplateFuncs_NumericAlias(t *testing.T) {
|
||||
svc, err := New()
|
||||
if err != nil {
|
||||
t.Fatalf("New() failed: %v", err)
|
||||
}
|
||||
SetDefault(svc)
|
||||
|
||||
tmpl, err := template.New("").Funcs(TemplateFuncs()).Parse(
|
||||
`{{n "number" 1234567}}|{{n "ago" 3 "hours"}}`,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Parse() failed: %v", err)
|
||||
}
|
||||
|
||||
var buf strings.Builder
|
||||
if err := tmpl.Execute(&buf, nil); err != nil {
|
||||
t.Fatalf("Execute() failed: %v", err)
|
||||
}
|
||||
|
||||
got := buf.String()
|
||||
if !strings.HasPrefix(got, "1,234,567|3 hours ago") {
|
||||
t.Fatalf("template numeric alias = %q, want prefix %q", got, "1,234,567|3 hours ago")
|
||||
}
|
||||
}
|
||||
|
||||
func TestTemplateFuncs_TimeHelpers(t *testing.T) {
|
||||
svc, err := New()
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue