File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,16 @@ function Assert::dirEmpty::emptyWithPattern { #@test
55
55
assert_line --index 0 --partial " INFO - Checking directory ${BATS_TEST_TMPDIR} /myDir is empty"
56
56
}
57
57
58
+ function Assert::dirEmpty::empty2Patterns { # @test
59
+ mkdir " ${BATS_TEST_TMPDIR} /myDir"
60
+ touch " ${BATS_TEST_TMPDIR} /myDir/.gitkeep"
61
+ touch " ${BATS_TEST_TMPDIR} /myDir/README.md"
62
+ run Assert::dirEmpty " ${BATS_TEST_TMPDIR} /myDir" " .gitkeep|README.md"
63
+ assert_success
64
+ assert_lines_count 1
65
+ assert_line --index 0 --partial " INFO - Checking directory ${BATS_TEST_TMPDIR} /myDir is empty"
66
+ }
67
+
58
68
function Assert::dirEmpty::emptyWithPatternButFileMatchingPatternNotThere { # @test
59
69
mkdir " ${BATS_TEST_TMPDIR} /myDir"
60
70
run Assert::dirEmpty " ${BATS_TEST_TMPDIR} /myDir" " .gitkeep"
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ Assert::dirEmpty() {
17
17
local pattern=" ${2:- } "
18
18
local -a filter=(cat)
19
19
if [[ -n " ${pattern} " ]]; then
20
- filter=(grep -v " ${pattern} " )
20
+ filter=(grep -v -E " ${pattern} " )
21
21
fi
22
22
Log::displayInfo " Checking directory ${directory} is empty"
23
23
if ${SUDO:- } test -f " ${directory} " ; then
You can’t perform that action at this time.
0 commit comments