aboutsummaryrefslogtreecommitdiff
path: root/src/time/format_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/time/format_test.go')
-rw-r--r--src/time/format_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/time/format_test.go b/src/time/format_test.go
index 1af41e2dfb3..93cbcf94013 100644
--- a/src/time/format_test.go
+++ b/src/time/format_test.go
@@ -832,3 +832,23 @@ func TestQuote(t *testing.T) {
}
}
+
+// Issue 48037
+func TestFormatFractionalSecondSeparators(t *testing.T) {
+ tests := []struct {
+ s, want string
+ }{
+ {`15:04:05.000`, `21:00:57.012`},
+ {`15:04:05.999`, `21:00:57.012`},
+ {`15:04:05,000`, `21:00:57,012`},
+ {`15:04:05,999`, `21:00:57,012`},
+ }
+
+ // The numeric time represents Thu Feb 4 21:00:57.012345600 PST 2009
+ time := Unix(0, 1233810057012345600)
+ for _, tt := range tests {
+ if q := time.Format(tt.s); q != tt.want {
+ t.Errorf("Format(%q) = got %q, want %q", tt.s, q, tt.want)
+ }
+ }
+}