read-rtl.c: split out read_rtx_operand from read_rtx_code
[official-gcc.git] / libgo / go / time / zoneinfo_test.go
blob5b6a4dc4e4ec2a9c653dd6d54d822ffd68a77a2c
1 // Copyright 2014 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.
5 package time_test
7 import (
8 "testing"
9 "time"
12 func TestVersion3(t *testing.T) {
13 t.Skip("gccgo does not use the zip file")
14 time.ForceZipFileForTesting(true)
15 defer time.ForceZipFileForTesting(false)
16 _, err := time.LoadLocation("Asia/Jerusalem")
17 if err != nil {
18 t.Fatal(err)
22 // Test that we get the correct results for times before the first
23 // transition time. To do this we explicitly check early dates in a
24 // couple of specific timezones.
25 func TestFirstZone(t *testing.T) {
26 t.Skip("gccgo does not use the zip file")
28 time.ForceZipFileForTesting(true)
29 defer time.ForceZipFileForTesting(false)
31 const format = "Mon, 02 Jan 2006 15:04:05 -0700 (MST)"
32 var tests = []struct {
33 zone string
34 unix int64
35 want1 string
36 want2 string
39 "PST8PDT",
40 -1633269601,
41 "Sun, 31 Mar 1918 01:59:59 -0800 (PST)",
42 "Sun, 31 Mar 1918 03:00:00 -0700 (PDT)",
45 "Pacific/Fakaofo",
46 1325242799,
47 "Thu, 29 Dec 2011 23:59:59 -1100 (TKT)",
48 "Sat, 31 Dec 2011 00:00:00 +1300 (TKT)",
52 for _, test := range tests {
53 z, err := time.LoadLocation(test.zone)
54 if err != nil {
55 t.Fatal(err)
57 s := time.Unix(test.unix, 0).In(z).Format(format)
58 if s != test.want1 {
59 t.Errorf("for %s %d got %q want %q", test.zone, test.unix, s, test.want1)
61 s = time.Unix(test.unix+1, 0).In(z).Format(format)
62 if s != test.want2 {
63 t.Errorf("for %s %d got %q want %q", test.zone, test.unix, s, test.want2)
68 func TestLocationNames(t *testing.T) {
69 if time.Local.String() != "Local" {
70 t.Errorf(`invalid Local location name: got %q want "Local"`, time.Local)
72 if time.UTC.String() != "UTC" {
73 t.Errorf(`invalid UTC location name: got %q want "UTC"`, time.UTC)