forked from ztombol/bats-file
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for temp_make and temp_del for setup_file and teardown_file
- Loading branch information
1 parent
cc4b614
commit 8d93763
Showing
7 changed files
with
88 additions
and
4 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
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
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,12 @@ | ||
#!/usr/bin/env bats | ||
|
||
load 'test_helper' | ||
|
||
setup_file() { | ||
local -ir BATSLIB_TEMP_PRESERVE_ON_FAILURE=1 | ||
temp_del "$TEST_TEMP_DIR" | ||
} | ||
|
||
@test "temp_del() <path>: \`BATSLIB_TEMP_PRESERVE_ON_FAILURE' does not work when called from \`setup_file'" { | ||
true | ||
} |
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,12 @@ | ||
#!/usr/bin/env bats | ||
|
||
load 'test_helper' | ||
|
||
@test "temp_del() <path>: \`BATSLIB_TEMP_PRESERVE_ON_FAILURE' works when called from \`teardown_file'" { | ||
false | ||
} | ||
|
||
teardown_file() { | ||
local -ir BATSLIB_TEMP_PRESERVE_ON_FAILURE=1 | ||
temp_del "$TEST_TEMP_DIR" | ||
} |
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,15 @@ | ||
#!/usr/bin/env bats | ||
|
||
load 'test_helper' | ||
|
||
setup_file() { | ||
TEST_TEMP_DIR="$(temp_make)" | ||
} | ||
|
||
@test "temp_make() <var>: works when called from \`setup_file'" { | ||
true | ||
} | ||
|
||
teardown_file() { | ||
rm -r -- "$TEST_TEMP_DIR" | ||
} |
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,12 @@ | ||
#!/usr/bin/env bats | ||
|
||
load 'test_helper' | ||
|
||
@test "temp_make() <var>: works when called from \`teardown_file'" { | ||
true | ||
} | ||
|
||
teardown_file() { | ||
TEST_TEMP_DIR="$(temp_make)" | ||
rm -r -- "$TEST_TEMP_DIR" | ||
} |