[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/i18n/RFC.md fully. Find features de... #149
2 changed files with 10 additions and 0 deletions
1
time.go
1
time.go
|
|
@ -54,6 +54,7 @@ func FormatAgo(count int, unit string) string {
|
|||
}
|
||||
|
||||
func normalizeAgoUnit(unit string) string {
|
||||
unit = core.Lower(core.Trim(unit))
|
||||
switch unit {
|
||||
case "seconds":
|
||||
return "second"
|
||||
|
|
|
|||
|
|
@ -173,6 +173,15 @@ func TestFormatAgo_Good_MorePluralUnitAliases(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestFormatAgo_Good_NormalisesUnitInput(t *testing.T) {
|
||||
svc, err := New()
|
||||
require.NoError(t, err)
|
||||
SetDefault(svc)
|
||||
|
||||
got := FormatAgo(2, " Hours ")
|
||||
assert.Equal(t, "2 hours ago", got)
|
||||
}
|
||||
|
||||
func TestFormatAgo_Bad_UnknownUnit(t *testing.T) {
|
||||
svc, err := New()
|
||||
require.NoError(t, err)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue