]> Cypherpunks repositories - gostls13.git/commitdiff
time: replace os.Setenv with T.Setenv
authorManlio Perillo <manlio.perillo@gmail.com>
Wed, 14 Apr 2021 13:01:56 +0000 (15:01 +0200)
committerIan Lance Taylor <iant@golang.org>
Wed, 14 Apr 2021 23:26:02 +0000 (23:26 +0000)
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>

src/time/zoneinfo_test.go

index 03229d192cd97f10f6650c2a200228fd3b3c23b9..136bb7bb8a504ae509c8c7ca391633e7bdc72608 100644 (file)
@@ -7,7 +7,6 @@ package time_test
 import (
        "errors"
        "fmt"
-       "os"
        "reflect"
        "testing"
        "time"
@@ -25,8 +24,7 @@ func TestEnvVarUsage(t *testing.T) {
        const testZoneinfo = "foo.zip"
        const env = "ZONEINFO"
 
-       defer os.Setenv(env, os.Getenv(env))
-       os.Setenv(env, testZoneinfo)
+       t.Setenv(env, testZoneinfo)
 
        // Result isn't important, we're testing the side effect of this command
        time.LoadLocation("Asia/Jerusalem")
@@ -50,8 +48,7 @@ func TestBadLocationErrMsg(t *testing.T) {
 func TestLoadLocationValidatesNames(t *testing.T) {
        time.ResetZoneinfoForTesting()
        const env = "ZONEINFO"
-       defer os.Setenv(env, os.Getenv(env))
-       os.Setenv(env, "")
+       t.Setenv(env, "")
 
        bad := []string{
                "/usr/foo/Foo",