THis time for sure
This commit is contained in:
parent
bef753d7ee
commit
7b326d72b1
@ -3,6 +3,7 @@ package download
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
@ -370,6 +371,7 @@ func TestLookForExecutable(t *testing.T) {
|
|||||||
t.Errorf("cannot run this test without knowing about sleep: %s", err)
|
t.Errorf("cannot run this test without knowing about sleep: %s", err)
|
||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
|
cmdDir := filepath.Dir(cmdPath)
|
||||||
|
|
||||||
cmd := "sleep"
|
cmd := "sleep"
|
||||||
path, err := absPathToExecutable(cmd)
|
path, err := absPathToExecutable(cmd)
|
||||||
@ -377,7 +379,7 @@ func TestLookForExecutable(t *testing.T) {
|
|||||||
assert.Equal(t, cmdPath, path)
|
assert.Equal(t, cmdPath, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd = "/bin/sleep"
|
cmd = cmdPath
|
||||||
path, err = absPathToExecutable(cmd)
|
path, err = absPathToExecutable(cmd)
|
||||||
if assert.NoError(t, err) {
|
if assert.NoError(t, err) {
|
||||||
assert.Equal(t, cmdPath, path)
|
assert.Equal(t, cmdPath, path)
|
||||||
@ -392,7 +394,7 @@ func TestLookForExecutable(t *testing.T) {
|
|||||||
_, err = absPathToExecutable(cmd)
|
_, err = absPathToExecutable(cmd)
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
|
|
||||||
os.Chdir("/bin")
|
os.Chdir(cmdDir)
|
||||||
cmd = "./sleep"
|
cmd = "./sleep"
|
||||||
path, err = absPathToExecutable(cmd)
|
path, err = absPathToExecutable(cmd)
|
||||||
if assert.NoError(t, err) {
|
if assert.NoError(t, err) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user