Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/goPublic

Commit370a9c9

Browse files
adgbradfitz
authored andcommitted
[release-branch.go1.3] time: removed from tests now obsolete assumption about Australian tz abbreviations
««« CL 130920043 / 7dba9475ee72time: removed from tests now obsolete assumption about Australian tz abbreviationsAustralian timezones abbreviation for standard and daylight saving time were recentlychanged from EST for both to AEST and AEDT in the icann tz database (see changelogonwww.iana.org/time-zones).A test in the time package was written to check that the ParseInLocation functionunderstand that Feb EST and Aug EST are different time zones, even though they areboth called EST. This is no longer the case, and the Date function now returnsAEST or AEDT for australian tz on every Linux system with an up to date tz database(and this makes the test fail).Since I wasn't able to find another country that 1) uses daylight saving and 2) hasthe same abbreviation for both on tzdata, I changed the test to make sure thatParseInLocation does not get confused when it parses, in different locations, twodates with the same abbreviation (this was suggested in the mailing list).Fixes#8547.LGTM=bradfitzR=golang-codereviews, bradfitzCC=golang-codereviewshttps://golang.org/cl/130920043»»»LGTM=dsymondsR=rsc, dsymondsCC=golang-codereviewshttps://golang.org/cl/153720043
1 parentf3c81ed commit370a9c9

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

‎src/pkg/time/format_test.go‎

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -183,39 +183,45 @@ func TestParse(t *testing.T) {
183183
}
184184
}
185185

186-
funcTestParseInSydney(t*testing.T) {
187-
loc,err:=LoadLocation("Australia/Sydney")
186+
funcTestParseInLocation(t*testing.T) {
187+
// Check that Parse (and ParseInLocation) understand that
188+
// Feb 01 AST (Arabia Standard Time) and Feb 01 AST (Atlantic Standard Time)
189+
// are in different time zones even though both are called AST
190+
191+
baghdad,err:=LoadLocation("Asia/Baghdad")
188192
iferr!=nil {
189193
t.Fatal(err)
190194
}
191195

192-
// Check that Parse (and ParseInLocation) understand
193-
// that Feb EST and Aug EST are different time zones in Sydney
194-
// even though both are called EST.
195-
t1,err:=ParseInLocation("Jan 02 2006 MST","Feb 01 2013 EST",loc)
196+
t1,err:=ParseInLocation("Jan 02 2006 MST","Feb 01 2013 AST",baghdad)
196197
iferr!=nil {
197198
t.Fatal(err)
198199
}
199-
t2:=Date(2013,February,1,00,00,00,0,loc)
200+
t2:=Date(2013,February,1,00,00,00,0,baghdad)
200201
ift1!=t2 {
201-
t.Fatalf("ParseInLocation(Feb 01 2013EST, Sydney) = %v, want %v",t1,t2)
202+
t.Fatalf("ParseInLocation(Feb 01 2013AST, Baghdad) = %v, want %v",t1,t2)
202203
}
203204
_,offset:=t1.Zone()
204-
ifoffset!=11*60*60 {
205-
t.Fatalf("ParseInLocation(Feb 01 2013 EST, Sydney).Zone = _, %d, want _, %d",offset,11*60*60)
205+
ifoffset!=3*60*60 {
206+
t.Fatalf("ParseInLocation(Feb 01 2013 AST, Baghdad).Zone = _, %d, want _, %d",offset,3*60*60)
207+
}
208+
209+
blancSablon,err:=LoadLocation("America/Blanc-Sablon")
210+
iferr!=nil {
211+
t.Fatal(err)
206212
}
207213

208-
t1,err=ParseInLocation("Jan 02 2006 MST","Aug 01 2013EST",loc)
214+
t1,err=ParseInLocation("Jan 02 2006 MST","Feb 01 2013AST",blancSablon)
209215
iferr!=nil {
210216
t.Fatal(err)
211217
}
212-
t2=Date(2013,August,1,00,00,00,0,loc)
218+
t2=Date(2013,February,1,00,00,00,0,blancSablon)
213219
ift1!=t2 {
214-
t.Fatalf("ParseInLocation(Aug 01 2013EST, Sydney) = %v, want %v",t1,t2)
220+
t.Fatalf("ParseInLocation(Feb 01 2013AST, Blanc-Sablon) = %v, want %v",t1,t2)
215221
}
216222
_,offset=t1.Zone()
217-
ifoffset!=10*60*60 {
218-
t.Fatalf("ParseInLocation(Aug 01 2013EST, Sydney).Zone = _, %d, want _, %d",offset,10*60*60)
223+
ifoffset!=-4*60*60 {
224+
t.Fatalf("ParseInLocation(Feb 01 2013AST, Blanc-Sablon).Zone = _, %d, want _, %d",offset,-4*60*60)
219225
}
220226
}
221227

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp