-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The effect of multiple -p options is the same as &&-ing the expressions together, but allowing them to be specified in separate options makes scripting test commands simpler.
- Loading branch information
Showing
6 changed files
with
59 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Test.Tasty | ||
import Test.Tasty.HUnit | ||
|
||
main :: IO () | ||
main = defaultMain $ testGroup "all" | ||
[ testGroup "red" | ||
[ testCase "square" $ pure () | ||
, testCase "circle" $ pure () | ||
] | ||
, testGroup "green" | ||
[ testCase "square" $ pure () | ||
, testCase "circle" $ pure () | ||
] | ||
] |
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,28 @@ | ||
#!/bin/sh | ||
|
||
set -eux | ||
|
||
if ! command -v multiple-pattern-test | ||
then | ||
echo "multiple-pattern-test executable is not in PATH, aborting" | ||
exit 1 | ||
fi | ||
|
||
[ "$(multiple-pattern-test -l | wc -l)" -eq 4 ] | ||
[ "$(multiple-pattern-test -l -p red | wc -l)" -eq 2 ] | ||
[ "$(multiple-pattern-test -l -p circle | wc -l)" -eq 2 ] | ||
[ "$(multiple-pattern-test -l -p red -p circle | wc -l)" -eq 1 ] | ||
[ "$(multiple-pattern-test -l -p red -p circle -p green | wc -l)" -eq 0 ] | ||
|
||
# Edge case: the empty pattern matches everything | ||
[ "$(multiple-pattern-test -l -p '' | wc -l)" -eq 4 ] | ||
[ "$(multiple-pattern-test -l -p '' -p '' | wc -l)" -eq 4 ] | ||
[ "$(multiple-pattern-test -l -p '' -p red | wc -l)" -eq 2 ] | ||
[ "$(multiple-pattern-test -l -p red -p '' | wc -l)" -eq 2 ] | ||
[ "$(multiple-pattern-test -l -p '' -p red -p '' | wc -l)" -eq 2 ] | ||
[ "$(multiple-pattern-test -l -p red -p '' -p circle | wc -l)" -eq 1 ] | ||
|
||
# Environment variable is entirely overridden by any command line options | ||
[ "$(TASTY_PATTERN=red.circle multiple-pattern-test -l | wc -l)" -eq 1 ] | ||
[ "$(TASTY_PATTERN=red.circle multiple-pattern-test -l -p square | wc -l)" -eq 2 ] | ||
[ "$(TASTY_PATTERN=red.circle multiple-pattern-test -l -p square -p green | wc -l)" -eq 1 ] |
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