github.com/embeddedgo/x@v0.0.6-0.20191217015414-d79a36f562e7/time/zoneinfo_test.go (about)

     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.
     4  
     5  package time_test
     6  
     7  import (
     8  	"github.com/embeddedgo/x/time"
     9  	"github.com/embeddedgo/x/time/tz"
    10  	"testing"
    11  )
    12  
    13  func TestLocationNames(t *testing.T) {
    14  	if time.Local.String() != "Local" {
    15  		t.Errorf(`invalid Local location name: got %q want "Local"`, time.Local)
    16  	}
    17  	if time.UTC.String() != "UTC" {
    18  		t.Errorf(`invalid UTC location name: got %q want "UTC"`, time.UTC)
    19  	}
    20  }
    21  
    22  // Issue 30099.
    23  func TestEarlyLocation(t *testing.T) {
    24  	d := time.Date(1900, time.January, 1, 0, 0, 0, 0, &tz.AmericaNewYork)
    25  	tzName, tzOffset := d.Zone()
    26  	if want := "EST"; tzName != want {
    27  		t.Errorf("Zone name == %s, want %s", tzName, want)
    28  	}
    29  	if want := -18000; tzOffset != want {
    30  		t.Errorf("Zone offset == %d, want %d", tzOffset, want)
    31  	}
    32  }