Add __builtion_unreachable to vector::size(), vector::capacity()
[official-gcc.git] / libgo / go / os / exec / lp_unix_test.go
blobbf602fcedb7e146aca1eddfbd8fd409fd0941495
1 // Copyright 2013 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 //go:build aix || darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd || solaris
7 package exec
9 import (
10 "os"
11 "testing"
14 func TestLookPathUnixEmptyPath(t *testing.T) {
15 tmp, err := os.MkdirTemp("", "TestLookPathUnixEmptyPath")
16 if err != nil {
17 t.Fatal("TempDir failed: ", err)
19 defer os.RemoveAll(tmp)
20 wd, err := os.Getwd()
21 if err != nil {
22 t.Fatal("Getwd failed: ", err)
24 err = os.Chdir(tmp)
25 if err != nil {
26 t.Fatal("Chdir failed: ", err)
28 defer os.Chdir(wd)
30 f, err := os.OpenFile("exec_me", os.O_CREATE|os.O_EXCL, 0700)
31 if err != nil {
32 t.Fatal("OpenFile failed: ", err)
34 err = f.Close()
35 if err != nil {
36 t.Fatal("Close failed: ", err)
39 t.Setenv("PATH", "")
41 path, err := LookPath("exec_me")
42 if err == nil {
43 t.Fatal("LookPath found exec_me in empty $PATH")
45 if path != "" {
46 t.Fatalf("LookPath path == %q when err != nil", path)