Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing directory #440

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions mob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2111,26 +2111,27 @@ func createFileInPath(t *testing.T, path, filename, content string) (pathToFile
}

func createExecutableFileInPath(t *testing.T, path, filename, content string) (pathToFile string) {
contentAsBytes := []byte(content)
ensureDirectoryExists(t, path)

pathToFile = path + "/" + filename
contentAsBytes := []byte(content)
err := os.WriteFile(pathToFile, contentAsBytes, 0755)
if err != nil {
failWithFailure(t, "creating file "+filename+" with content "+content, "error")
}
return
}

func createDirectory(t *testing.T, directory string) (pathToFile string) {
return createDirectoryInPath(t, workingDir, directory)
func createDirectory(t *testing.T, directory string) (pathToDirectory string) {
return ensureDirectoryExists(t, workingDir+"/"+directory)
}

func createDirectoryInPath(t *testing.T, path, directory string) (pathToFile string) {
pathToFile = path + "/" + directory
err := os.Mkdir(pathToFile, 0755)
func ensureDirectoryExists(t *testing.T, path string) (pathToDirectory string) {
err := os.MkdirAll(path, 0755)
if err != nil {
failWithFailure(t, "creating directory "+pathToFile, "error")
failWithFailure(t, "creating folder "+path, "error")
}
return
return path
}

func removeFile(t *testing.T, path string) {
Expand Down
Loading