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
14 func TestLookPathUnixEmptyPath(t
*testing
.T
) {
15 tmp
, err
:= os
.MkdirTemp("", "TestLookPathUnixEmptyPath")
17 t
.Fatal("TempDir failed: ", err
)
19 defer os
.RemoveAll(tmp
)
22 t
.Fatal("Getwd failed: ", err
)
26 t
.Fatal("Chdir failed: ", err
)
30 f
, err
:= os
.OpenFile("exec_me", os
.O_CREATE|os
.O_EXCL
, 0700)
32 t
.Fatal("OpenFile failed: ", err
)
36 t
.Fatal("Close failed: ", err
)
41 path
, err
:= LookPath("exec_me")
43 t
.Fatal("LookPath found exec_me in empty $PATH")
46 t
.Fatalf("LookPath path == %q when err != nil", path
)