Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 44 for unsetEnv (0.14 sec)

  1. src/time/zoneinfo_unix_test.go

    //go:build unix && !ios && !android
    
    package time_test
    
    import (
    	"os"
    	"testing"
    	"time"
    )
    
    func TestEnvTZUsage(t *testing.T) {
    	const env = "TZ"
    	tz, ok := os.LookupEnv(env)
    	if !ok {
    		defer os.Unsetenv(env)
    	} else {
    		defer os.Setenv(env, tz)
    	}
    	defer time.ForceUSPacificForTesting()
    
    	localZoneName := "Local"
    	// The file may not exist.
    	if _, err := os.Stat("/etc/localtime"); os.IsNotExist(err) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 29 16:24:51 UTC 2022
    - 2.3K bytes
    - Viewed (0)
  2. cmd/update_test.go

    		}
    		if !strings.Contains(str, expectedStr) {
    			t.Errorf("Test %d: expected: %s, got: %s", i+1, expectedStr, str)
    		}
    		globalIsCICD = sci
    		os.Unsetenv("MARATHON_APP_LABEL_DCOS_PACKAGE_VERSION")
    		os.Unsetenv(testCase.envName)
    	}
    }
    
    // Tests if the environment we are running is in DCOS.
    func TestIsDCOS(t *testing.T) {
    	sci := globalIsCICD
    	globalIsCICD = false
    	defer func() {
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Sat Mar 09 03:07:08 UTC 2024
    - 10.7K bytes
    - Viewed (0)
  3. src/syscall/env_unix.go

    					env[key] = i // first mention of key
    				} else {
    					// Clear duplicate keys. This permits Unsetenv to
    					// safely delete only the first item without
    					// worrying about unshadowing a later one,
    					// which might be a security problem.
    					envs[i] = ""
    				}
    				break
    			}
    		}
    	}
    }
    
    func Unsetenv(key string) error {
    	envOnce.Do(copyenv)
    
    	envLock.Lock()
    	defer envLock.Unlock()
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 06 20:58:35 UTC 2023
    - 2.7K bytes
    - Viewed (0)
  4. src/os/env_unix_test.go

    	{"@", "at"},
    	{"!", "exclamation mark"},
    	{"?", "question mark"},
    	{"-", "dash"},
    }
    
    func TestExpandEnvShellSpecialVar(t *testing.T) {
    	for _, tt := range shellSpecialVarTests {
    		Setenv(tt.k, tt.v)
    		defer Unsetenv(tt.k)
    
    		argRaw := fmt.Sprintf("$%s", tt.k)
    		argWithBrace := fmt.Sprintf("${%s}", tt.k)
    		if gotRaw, gotBrace := ExpandEnv(argRaw), ExpandEnv(argWithBrace); gotRaw != gotBrace {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 29 16:24:51 UTC 2022
    - 1.2K bytes
    - Viewed (0)
  5. src/net/http/proxy_test.go

    		}
    	}
    }
    
    func ResetProxyEnv() {
    	for _, v := range []string{"HTTP_PROXY", "http_proxy", "NO_PROXY", "no_proxy", "REQUEST_METHOD"} {
    		os.Unsetenv(v)
    	}
    	ResetCachedEnvironment()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 01 05:30:49 UTC 2020
    - 1.2K bytes
    - Viewed (0)
  6. pkg/probe/http/http_test.go

    	"k8s.io/apimachinery/pkg/util/wait"
    	"k8s.io/kubernetes/pkg/probe"
    )
    
    const FailureCode int = -1
    
    func unsetEnv(t testing.TB, key string) {
    	if originalValue, ok := os.LookupEnv(key); ok {
    		t.Cleanup(func() { os.Setenv(key, originalValue) })
    		os.Unsetenv(key)
    	}
    }
    
    func TestHTTPProbeProxy(t *testing.T) {
    	res := "welcome to http probe proxy"
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Apr 18 01:40:08 UTC 2023
    - 15.7K bytes
    - Viewed (0)
  7. src/cmd/go/internal/generate/generate_test.go

    	os.Unsetenv("_X")
    	inLine = "//go:generate CMD0"
    	expected = []string{"abcd"}
    	got = g.split(inLine + "\n")
    
    	if !reflect.DeepEqual(got, expected) {
    		t.Errorf("split(%q): got %q expected %q", inLine, got, expected)
    	}
    
    	// Try another undefined variable as an extra check
    	os.Unsetenv("_Z")
    	inLine = "//go:generate -command CMD1 \"ab${_Z}cd\""
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 20 14:09:12 UTC 2022
    - 7.4K bytes
    - Viewed (0)
  8. src/cmd/go/internal/toolchain/exec.go

    // The GOROOT directory is empty if we are invoking a command named
    // gotoolchain found in $PATH.
    func execGoToolchain(gotoolchain, dir, exe string) {
    	os.Setenv(targetEnv, gotoolchain)
    	if dir == "" {
    		os.Unsetenv("GOROOT")
    	} else {
    		os.Setenv("GOROOT", dir)
    	}
    
    	// On Windows, there is no syscall.Exec, so the best we can do
    	// is run a subprocess and exit with the same status.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Dec 19 14:42:39 UTC 2023
    - 1.6K bytes
    - Viewed (0)
  9. pkg/test/util.go

    	if err := os.Setenv(k, v); err != nil {
    		t.Fatal(err)
    	}
    	t.Cleanup(func() {
    		if oldset {
    			if err := os.Setenv(k, old); err != nil {
    				t.Fatal(err)
    			}
    		} else {
    			if err := os.Unsetenv(k); err != nil {
    				t.Fatal(err)
    			}
    		}
    	})
    }
    
    // SetAtomicBoolForTest sets a variable for the duration of a test, then resets it once the test is complete atomically.
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri Jan 05 01:20:59 UTC 2024
    - 1.9K bytes
    - Viewed (0)
  10. platforms/core-runtime/native/src/main/java/org/gradle/internal/nativeintegration/ReflectiveEnvironment.java

    import java.lang.reflect.Field;
    import java.util.Map;
    
    /**
     * Uses reflection to update private environment state
     */
    public class ReflectiveEnvironment {
    
        public void unsetenv(String name) {
            Map<String, String> map = getEnv();
            map.remove(name);
            if (OperatingSystem.current().isWindows()) {
                Map<String, String> env2 = getWindowsEnv();
                env2.remove(name);
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Fri Sep 22 09:06:40 UTC 2023
    - 2.7K bytes
    - Viewed (0)
Back to top