mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
time: replace os.Setenv with T.Setenv
Updates #45448 Change-Id: Ic096fe1c58c124fb8d84ee15c9446e7ed060b24f Reviewed-on: https://go-review.googlesource.com/c/go/+/310032 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
parent
c3931ab1b7
commit
f18715c18f
1 changed files with 2 additions and 5 deletions
|
|
@ -7,7 +7,6 @@ package time_test
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -25,8 +24,7 @@ func TestEnvVarUsage(t *testing.T) {
|
||||||
const testZoneinfo = "foo.zip"
|
const testZoneinfo = "foo.zip"
|
||||||
const env = "ZONEINFO"
|
const env = "ZONEINFO"
|
||||||
|
|
||||||
defer os.Setenv(env, os.Getenv(env))
|
t.Setenv(env, testZoneinfo)
|
||||||
os.Setenv(env, testZoneinfo)
|
|
||||||
|
|
||||||
// Result isn't important, we're testing the side effect of this command
|
// Result isn't important, we're testing the side effect of this command
|
||||||
time.LoadLocation("Asia/Jerusalem")
|
time.LoadLocation("Asia/Jerusalem")
|
||||||
|
|
@ -50,8 +48,7 @@ func TestBadLocationErrMsg(t *testing.T) {
|
||||||
func TestLoadLocationValidatesNames(t *testing.T) {
|
func TestLoadLocationValidatesNames(t *testing.T) {
|
||||||
time.ResetZoneinfoForTesting()
|
time.ResetZoneinfoForTesting()
|
||||||
const env = "ZONEINFO"
|
const env = "ZONEINFO"
|
||||||
defer os.Setenv(env, os.Getenv(env))
|
t.Setenv(env, "")
|
||||||
os.Setenv(env, "")
|
|
||||||
|
|
||||||
bad := []string{
|
bad := []string{
|
||||||
"/usr/foo/Foo",
|
"/usr/foo/Foo",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue