summaryrefslogtreecommitdiff
path: root/src/time/format_test.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2018-01-03 10:24:29 -0800
committerIan Lance Taylor <iant@golang.org>2018-01-03 20:50:44 +0000
commit86cca11ffde0a4a353f0cc7bf7cfcdffd7929398 (patch)
treeb0ce4afebc5e1db6ac330031f5e3cab406dc1ae2 /src/time/format_test.go
parent74d8340cf6d8fc958992ded4ffb6c4a53327dfa1 (diff)
downloadgo-git-86cca11ffde0a4a353f0cc7bf7cfcdffd7929398.tar.gz
time: revert CL 78735 (was: space padding using underscore)
CL 78735 description: time: add space padding layout strings(using underscore) for not only day but others As mentioned in #22802, only day component of layout string has space padding(represented by one underscore before its placeholder). This commit expands the rule for month, hour, minute and second. Updates #22802 (maybe fixes it) Revert this CL because it breaks currently working formats that happen to use underscores. Fixes #23259 Change-Id: I64acaaca9b5b74785ee0f0be7910574e87daa649 Reviewed-on: https://go-review.googlesource.com/85998 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Rob Pike <r@golang.org>
Diffstat (limited to 'src/time/format_test.go')
-rw-r--r--src/time/format_test.go34
1 files changed, 0 insertions, 34 deletions
diff --git a/src/time/format_test.go b/src/time/format_test.go
index 9871976ad5..6d27f468c7 100644
--- a/src/time/format_test.go
+++ b/src/time/format_test.go
@@ -116,18 +116,6 @@ func TestFormatShortYear(t *testing.T) {
}
}
-// issue 22802.
-func TestFormatSpacePadding(t *testing.T) {
- for i := 9; i <= 10; i++ {
- time := Date(2001, Month(i), i, i, i, i, 700000000, UTC)
- result := time.Format("2006-_1-_2 _3:_4:_5")
- want := fmt.Sprintf("2001-%2d-%2d %2d:%2d:%2d", i, i, i, i, i)
- if result != want {
- t.Errorf("SpacePadding expected %q got %q", want, result)
- }
- }
-}
-
type ParseTest struct {
name string
format string
@@ -639,25 +627,3 @@ func TestUnderscoreTwoThousand(t *testing.T) {
t.Errorf("Incorrect minute, got %d", m)
}
}
-
-// issue 22802.
-func TestParseSpacePadding(t *testing.T) {
- format := "2006-_1-_2 _3:_4:_5"
- input := "2017- 9- 6 8: 4: 2"
- time, err := Parse(format, input)
- if err != nil {
- t.Error(err)
- }
- if y, m, d := time.Date(); y != 2017 || m != 9 || d != 6 {
- t.Errorf("Incorrect y/m/d, got %d/%d/%d", y, m, d)
- }
- if h := time.Hour(); h != 8 {
- t.Errorf("Incorrect hour, got %d", h)
- }
- if m := time.Minute(); m != 4 {
- t.Errorf("Incorrect minute, got %d", m)
- }
- if s := time.Second(); s != 2 {
- t.Errorf("Incorrect second, got %d", s)
- }
-}