github.com/pavlo67/common@v0.5.3/common/filelib/files_test.go (about) 1 // +build linux 2 3 package filelib 4 5 import ( 6 "fmt" 7 "log" 8 "os/exec" 9 "strings" 10 "testing" 11 ) 12 13 func TestCurrentPath(t *testing.T) { 14 path := CurrentPath() 15 currentPath_, err := exec.Command("pwd").Output() 16 //currentPath_, err := exec.Command("cmd", "/C", "cd",).Output() 17 if err != nil { 18 log.Fatal(err) 19 } 20 currentPath := strings.Trim(string(currentPath_), "\t\n\r") + "/" 21 22 if currentPath != path { 23 t.Error(fmt.Errorf("bad current path: %v vs. %v", path, currentPath)) 24 } 25 }