github.com/hongwozai/go-src-1.4.3@v0.0.0-20191127132709-dc3fce3dbccb/src/time/zoneinfo_windows_test.go (about) 1 // Copyright 2013 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package time_test 6 7 import ( 8 "testing" 9 . "time" 10 ) 11 12 func testZoneAbbr(t *testing.T) { 13 t1 := Now() 14 // discard nsec 15 t1 = Date(t1.Year(), t1.Month(), t1.Day(), t1.Hour(), t1.Minute(), t1.Second(), 0, t1.Location()) 16 t2, err := Parse(RFC1123, t1.Format(RFC1123)) 17 if err != nil { 18 t.Fatalf("Parse failed: %v", err) 19 } 20 if t1 != t2 { 21 t.Fatalf("t1 (%v) is not equal to t2 (%v)", t1, t2) 22 } 23 } 24 25 func TestLocalZoneAbbr(t *testing.T) { 26 ResetLocalOnceForTest() // reset the Once to trigger the race 27 defer ForceUSPacificForTesting() 28 testZoneAbbr(t) 29 } 30 31 func TestAusZoneAbbr(t *testing.T) { 32 ForceAusForTesting() 33 defer ForceUSPacificForTesting() 34 testZoneAbbr(t) 35 }