-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mkdir] barebones commands test structure
- Loading branch information
1 parent
2924641
commit 3ad74f1
Showing
4 changed files
with
47 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
build*/ | ||
tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"codeberg.org/whou/simpleutils/internal/test" | ||
) | ||
|
||
func TestParentsNoErrIfDirExists(t *testing.T) { | ||
binPrefix := os.Getenv("PREFIX") | ||
if binPrefix == "" { | ||
t.Fatal("Required PREFIX environment variable not found.") | ||
} | ||
|
||
binDir := os.Getenv("BUILD_DIR") | ||
if binDir == "" { | ||
t.Fatal("Required BUILD_DIR environment variable not found.") | ||
} | ||
|
||
binPath := binDir + "/" + binPrefix + "mkdir" | ||
|
||
// create directory | ||
testDir := t.TempDir() | ||
|
||
// try use mkdir in the already created directory with `-p` flag | ||
out, code, err := test.GetCmdOutput(binPath, "-p", testDir) | ||
t.Log(out) | ||
|
||
if code != 0 { | ||
t.Fatalf("Process ran with err \"%v\", expected exit status 0.", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters