Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions roundup.1.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ roundup(5). If all tests pass, the shell is roundup-ready.
* `--version`:
Display version and exit.

* `--exclude pattern` or `-e pattern`:
Exclude tests cases with name matching `pattern`. Eg. roundup --exclude *runs_after*

* `--include pattern` or `-i pattern`:
Execute tests cases only with name matching `pattern`. Eg. roundup --include *runs_after*

## BEHAVIOUR

`roundup` run with no <plan>(s) specified will attempt to run all files matching
Expand Down
23 changes: 21 additions & 2 deletions roundup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export ROUNDUP_VERSION
# Usage is defined in a specific comment syntax. It is `grep`ed out of this file
# when needed (i.e. The Tomayko Method). See
# [shocco](http://rtomayko.heroku.com/shocco) for more detail.
#/ usage: roundup [--help|-h] [--version|-v] [plan ...]
#/ usage: roundup [--help|-h] [--version|-v] [--include|-i pattern] [--exclude|-e pattern] [plan ...]

roundup_usage() {
grep '^#/' <"$0" | cut -c4-
Expand All @@ -62,6 +62,16 @@ do
color=always
shift
;;
--include|-i)
shift
include=$1
shift
;;
--exclude|-e)
shift
exclude=$1
shift
;;
-)
echo >&2 "roundup: unknown switch $1"
exit 1
Expand Down Expand Up @@ -222,11 +232,20 @@ do
# This is done before populating the sandbox with tests to avoid odd
# conflicts.

# Filter test cases for exclude and include patterns
filter_tests() {
while read test; do
case "$test" in $exclude) break ;; esac
case "$test" in ${include:-*}) echo "$test" ;; esac
done
}

# TODO: I want to do this with sed only. Please send a patch if you
# know a cleaner way.
roundup_plan=$(
grep "^it_.*()" $roundup_p |
sed "s/\(it_[a-zA-Z0-9_]*\).*$/\1/g"
sed "s/\(it_[a-zA-Z0-9_]*\).*$/\1/g" |
filter_tests
)

# We have the test plan and are in our sandbox with [roundup(5)][r5]
Expand Down