Fix duration saying never when it's unlimited

This commit is contained in:
2026-09-13 09:10:46 +02:00
parent e7344f8aab
commit b24467c37d
5 changed files with 22 additions and 4 deletions
+8
View File
@@ -78,6 +78,14 @@ func TestFormatRoundTrips(t *testing.T) {
if got, err := ParseDuration(FormatDuration(d)); err != nil || got != d {
t.Errorf("FormatDuration(%s) = %q, which parses back to %s (%v)", d, FormatDuration(d), got, err)
}
// FormatLifetime reaches the upload form as the expiry placeholder, so
// what it prints has to be something a caller could type back.
if got, err := ParseDuration(FormatLifetime(d)); err != nil || got != d {
t.Errorf("FormatLifetime(%s) = %q, which parses back to %s (%v)", d, FormatLifetime(d), got, err)
}
}
if got := FormatLifetime(Unlimited); got != "unlimited" {
t.Errorf("FormatLifetime(Unlimited) = %q, want %q", got, "unlimited")
}
}