From e2f011c71d901c8645e2f5ea2b5666b9d85bf977 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Wed, 10 May 2017 01:10:14 -0400 Subject: [PATCH] s/::/:/g function names The Google coding standard that used `::' was cute and all, but without a broader framework to surround it (which I do not have time for atm), it's too much. `:' seems just as reasonable as a namespace delimiter. --- src/expect.sh | 16 ++++++------ src/expect/env.sh | 22 ++++++++-------- src/expect/output.sh | 26 +++++++++---------- src/run-spec | 4 +-- src/spec.sh | 58 +++++++++++++++++++++---------------------- src/specstack.sh | 40 ++++++++++++++--------------- test/test-expect-core | 58 +++++++++++++++++++++---------------------- test/test-expect-env | 2 +- test/test-spec | 20 +++++++-------- 9 files changed, 123 insertions(+), 123 deletions(-) diff --git a/src/expect.sh b/src/expect.sh index a5b536d..37918cc 100644 --- a/src/expect.sh +++ b/src/expect.sh @@ -28,12 +28,12 @@ source expect/env.sh ## # Shorthand for bailing out on unrecognized clauses -shspec::bail-clause() +shspec:bail-clause() { local -r type="$1" local -r clause="$2" - shspec::bail "unrecognized \`$type' clause: \`$2'" + shspec:bail "unrecognized \`$type' clause: \`$2'" } @@ -44,12 +44,12 @@ shspec::bail-clause() # where the remainder clause begins; this ensures that shspec can continue # to evolve in the future without BC breaks in properly designed expection # handlers. -shspec::_chk-shiftn() +shspec:_chk-shiftn() { local -ri expect="$1" local -ri given="$2" - test "$given" -ge "$expect" || shspec::bail \ + test "$given" -ge "$expect" || shspec:bail \ "internal: expected shift of at least $expect, but given $given" } @@ -59,16 +59,16 @@ shspec::_chk-shiftn() # spoken # # For example, "to be silent". -shspec::expect::be() { shspec::proxy-to "$@"; } +shspec:expect:be() { shspec:proxy-to "$@"; } ## # Basic success and failure (zero or non-zero exit code) -shspec::expect::succeed() { test "$1" -eq 0; } -shspec::expect::fail() { test "$1" -ne 0; } +shspec:expect:succeed() { test "$1" -eq 0; } +shspec:expect:fail() { test "$1" -ne 0; } ## # Inverts the result of an expectation represented by the remainder clause -shspec::expect::not() { ! shspec::proxy-to "$@"; } +shspec:expect:not() { ! shspec:proxy-to "$@"; } diff --git a/src/expect/env.sh b/src/expect/env.sh index a9d18ea..a38c302 100644 --- a/src/expect/env.sh +++ b/src/expect/env.sh @@ -27,7 +27,7 @@ __INC_EXPECT_ENV=1 # Expect that an environment variable is set to a particular value, or # assert on flags # -shspec::expect::__env() +shspec:expect:__env() { local -r expflags="$1" var="$2" cmp="$3" shift 3 @@ -35,7 +35,7 @@ shspec::expect::__env() # TODO: support escaped newlines local flags val - shspec::expect::__read-env-line "$var" flags val < "$envpath" + shspec:expect:__read-env-line "$var" flags val < "$envpath" # perform flag assertion if requested test -n "$expflags" && { @@ -74,7 +74,7 @@ shspec::expect::__env() # Expected output is of the form: # declare -flags? -- var="val" # -shspec::expect::__read-env-line() +shspec:expect:__read-env-line() { local -r var="$1" destflag="$2" destval="$3" @@ -90,26 +90,26 @@ shspec::expect::__read-env-line() ## # Expect that an environment variable has been set to a certain value # -shspec::expect::set() +shspec:expect:set() { local -ri shiftn="$2" local -r envpath="$4" shift "$shiftn" # ensure envpath is available - shspec::_chk-shiftn 4 "$shiftn" + shspec:_chk-shiftn 4 "$shiftn" # no flag expectation - shspec::expect::__env '' "$@" + shspec:expect:__env '' "$@" } ## # Alias for `set` # -shspec::expect::declare() +shspec:expect:declare() { - shspec::expect::set "$@" + shspec:expect:set "$@" } @@ -118,16 +118,16 @@ shspec::expect::declare() # # Same syntax as `set` # -shspec::expect::export() +shspec:expect:export() { local -ri shiftn="$2" local -r envpath="$4" shift "$shiftn" # ensure envpath is available - shspec::_chk-shiftn 4 "$shiftn" + shspec:_chk-shiftn 4 "$shiftn" # expect the -x flag, which denotes export - shspec::expect::__env x "$@" + shspec:expect:__env x "$@" } diff --git a/src/expect/output.sh b/src/expect/output.sh index 510aab0..f8fac56 100644 --- a/src/expect/output.sh +++ b/src/expect/output.sh @@ -45,7 +45,7 @@ exec 99<>/dev/null # # This command is successful if and only if both the remainder clause and # the provided command line complete successfully. -shspec::expect::__output-cmd() +shspec:expect:__output-cmd() { local -r cmd="$1" shift @@ -62,11 +62,11 @@ shspec::expect::__output-cmd() local nl local intype { - shspec::expect::__output-clause "${clause[@]}" | { + shspec:expect:__output-clause "${clause[@]}" | { IFS=\| read nl intype if [ "$intype" == stderr ]; then - shspec::_chk-shiftn 3 "$shiftn" + shspec:_chk-shiftn 3 "$shiftn" exec 99<"$stderr" fi @@ -78,7 +78,7 @@ shspec::expect::__output-cmd() } # parses output remainder clause according to the aforementioned rules -shspec::expect::__output-clause() +shspec:expect:__output-clause() { [ $# -gt 0 ] || return 0 @@ -88,7 +88,7 @@ shspec::expect::__output-clause() if [[ "$1 $2" =~ ^on\ std(err|out) ]]; then [ "$2" == stderr ] && input="$2" else - shspec::bail-clause output "$*" + shspec:bail-clause output "$*" fi fi @@ -105,7 +105,7 @@ shspec::expect::__output-clause() # # This expectation assumes a trailing newline by default; this behavior can # be suppressed with the `without newline' clause. -shspec::expect::output() +shspec:expect:output() { local -a args=("$@") local -i shiftn="$2" @@ -122,11 +122,11 @@ shspec::expect::output() fi fi - shspec::expect::__output-cmd "shspec::expect::__output-do -$nl" \ + shspec:expect:__output-cmd "shspec:expect:__output-do -$nl" \ "${args[@]}" } -shspec::expect::__output-do() +shspec:expect:__output-do() { local -r nl="${1:1}" local -r cmp="$2" @@ -140,12 +140,12 @@ shspec::expect::__output-do() ## # Expects that stdout matches the provided extended regular expression (as # in regex(3)) -shspec::expect::match() +shspec:expect:match() { - shspec::expect::__output-cmd 'shspec::expect::__match-do' "$@" + shspec:expect:__output-cmd 'shspec:expect:__match-do' "$@" } -shspec::expect::__match-do() +shspec:expect:__match-do() { local -r pat="$1" [[ "$(cat)" =~ $pat ]] @@ -154,13 +154,13 @@ shspec::expect::__match-do() ## # Expects that both stdin and stderr (if available) are empty -shspec::expect::silent() +shspec:expect:silent() { local -r stderr="${3:-/dev/null}" shift "$2" # we accept no arguments - test $# -eq 0 || shspec::bail-clause silent "$*" + test $# -eq 0 || shspec:bail-clause silent "$*" # quick read using builtins; if we find any single byte, then we know that # it is non-empty diff --git a/src/run-spec b/src/run-spec index 5c71ec6..73fe053 100755 --- a/src/run-spec +++ b/src/run-spec @@ -23,9 +23,9 @@ source spec.sh declare -r tcase="${1?Missing test case path}" -shspec::begin-spec +shspec:begin-spec cd "$( dirname "$tcase" )" \ && source "$tcase" \ || exit $? -shspec::end-spec +shspec:end-spec diff --git a/src/spec.sh b/src/spec.sh index 7ea9b0a..d3bf81c 100644 --- a/src/spec.sh +++ b/src/spec.sh @@ -38,7 +38,7 @@ declare -ir __SHIFTN=4 ## # Attempts to make tempoary path in /dev/shm, falling back to default -shspec::__mktemp-shm() +shspec:__mktemp-shm() { local -r shm=/dev/shm [ -d $shm -a -r $shm ] && mktemp -p$shm || mktemp @@ -46,11 +46,11 @@ shspec::__mktemp-shm() # std{out,err} file -readonly __spec_outpath="$(shspec::__mktemp-shm)" -readonly __spec_errpath="$(shspec::__mktemp-shm)" +readonly __spec_outpath="$(shspec:__mktemp-shm)" +readonly __spec_errpath="$(shspec:__mktemp-shm)" # env dump file -readonly __spec_envpath="$(shspec::__mktemp-shm)" +readonly __spec_envpath="$(shspec:__mktemp-shm)" # most recent expect result exit code declare -i __spec_rexit=0 @@ -64,7 +64,7 @@ declare __spec_caller= # # A specification is any shell script using the specification commands # defined herein. -shspec::begin-spec() +shspec:begin-spec() { : placeholder } @@ -75,15 +75,15 @@ shspec::begin-spec() # # If the specification was improperly nested, this will output a list of # nesting errors and return a non-zero error. Otherwise, nothing is done. -shspec::end-spec() +shspec:end-spec() { # if the stack is empty then everything is in order - shspec::stack::_empty && return 0 + shspec:stack:_empty && return 0 # otherwise, output an error message for each item in the stack - until shspec::stack::_empty; do - shspec::stack::_read type line file _ < <(shspec::stack::_head) - shspec::stack::_pop + until shspec:stack:_empty; do + shspec:stack:_read type line file _ < <(shspec:stack:_head) + shspec:stack:_pop echo "error: unterminated \`$type' at $file:$line" done @@ -100,7 +100,7 @@ shspec::end-spec() describe() { local -r desc="$*" - shspec::stack::_push "describe" $(caller) "$desc" + shspec:stack:_push "describe" $(caller) "$desc" } @@ -111,7 +111,7 @@ describe() it() { local -r desc="$*" - shspec::stack::_push "it" $(caller) "$desc" + shspec:stack:_push "it" $(caller) "$desc" } @@ -122,16 +122,16 @@ it() # should not use this command. end() { - local -r head="$(shspec::stack::_head-type)" + local -r head="$(shspec:stack:_head-type)" local -r cleanhead="$head" # some statements are implicitly terminated; explicitly doing so is # indicitive of a syntax issue [ "${head:0:1}" != : ] \ - || shspec::bail \ + || shspec:bail \ "unexpected \`end': still processing \`$cleanhead'" $(caller) - shspec::stack::_pop >/dev/null || shspec::bail "unmatched \`end'" + shspec:stack:_pop >/dev/null || shspec:bail "unmatched \`end'" } @@ -145,10 +145,10 @@ end() # That is, this declares "given this command, I can expect that..." expect() { - shspec::stack::_assert-within it expect $(caller) + shspec:stack:_assert-within it expect $(caller) ( "$@" >"$__spec_outpath" 2>"$__spec_errpath" ) __spec_rexit=$? - shspec::stack::_push :expect $(caller) "$@" + shspec:stack:_push :expect $(caller) "$@" } @@ -162,12 +162,12 @@ to() __spec_caller=${__spec_caller:-$(caller)} [ $# -gt 0 ] || \ - shspec::bail "missing assertion string for \`to'" $__spec_caller + shspec:bail "missing assertion string for \`to'" $__spec_caller - shspec::stack::_assert-follow :expect to $(caller) - shspec::stack::_pop + shspec:stack:_assert-follow :expect to $(caller) + shspec:stack:_pop - shspec::__handle-to "$__spec_rexit" $__SHIFTN \ + shspec:__handle-to "$__spec_rexit" $__SHIFTN \ "$__spec_errpath" "$__spec_envpath" "$@" \ || fail "$*" @@ -183,7 +183,7 @@ to() # # <...N> <...remainder clause> # -shspec::__handle-to() +shspec:__handle-to() { local -ri rexit="$1" local -ri shiftn="$2" @@ -194,9 +194,9 @@ shspec::__handle-to() local -r type="$1" shift - local -r assert="shspec::expect::$type" + local -r assert="shspec:expect:$type" type "$assert" &>/dev/null \ - || shspec::bail "unknown expectation: \`$type'" $__spec_caller + || shspec:bail "unknown expectation: \`$type'" $__spec_caller # first argument is exit code, second is the number of arguments to shift # to place $1 at the remainder clause, third is the path to the stderr @@ -212,7 +212,7 @@ shspec::__handle-to() # Alias for _handle-to # # Shows intent to proxy a call and allows proxy implementation to vary. -shspec::proxy-to() { shspec::__handle-to "$@"; } +shspec:proxy-to() { shspec:__handle-to "$@"; } ## @@ -223,8 +223,8 @@ and() # the most recently popped value should be an expect premise, implying # that an expectation declaration implicitly popped it - shspec::stack::_unpop - shspec::stack::_assert-within :expect and $(caller) \ + shspec:stack:_unpop + shspec:stack:_assert-within :expect and $(caller) \ "follow an expectation as part of" "$@" @@ -251,7 +251,7 @@ fail() echo " exit code: $__spec_rexit" echo - shspec::bail "expectation failure" + shspec:bail "expectation failure" } @@ -263,7 +263,7 @@ fail() # # If no file and line number are provided, this will default to the current # spec caller, if any. -shspec::bail() +shspec:bail() { local -r msg="$1" local line="$2" diff --git a/src/specstack.sh b/src/specstack.sh index a00ceac..1da13c8 100644 --- a/src/specstack.sh +++ b/src/specstack.sh @@ -28,7 +28,7 @@ declare -i __sstackp=0 ## # Push a frame onto the stack -shspec::stack::_push() +shspec:stack:_push() { local -r type="$1" local -r srcline="$2" @@ -44,7 +44,7 @@ shspec::stack::_push() # Pop a frame from the stack # # It is possible to recover the most recently popped frame. -shspec::stack::_pop() +shspec:stack:_pop() { [ "$__sstackp" -gt 0 ] || return 1 @@ -61,7 +61,7 @@ shspec::stack::_pop() # Note that this should never be called more than once in an attempt to # recover additional frames; it will not work, and you will make bad things # happen, and people will hate you. -shspec::stack::_unpop() +shspec:stack:_unpop() { ((__sstackp++)) } @@ -69,7 +69,7 @@ shspec::stack::_unpop() ## # Return with a non-zero status only if the stack is non-empty -shspec::stack::_empty() +shspec:stack:_empty() { test "$__sstackp" -eq 0 } @@ -77,7 +77,7 @@ shspec::stack::_empty() ## # Output the current size of the stack -shspec::stack::_size() +shspec:stack:_size() { echo "$__sstackp" } @@ -85,7 +85,7 @@ shspec::stack::_size() ## # Output the current stack frame -shspec::stack::_head() +shspec:stack:_head() { local -ri headi=$((__sstackp-1)) echo "${__sstack[$headi]}" @@ -94,27 +94,27 @@ shspec::stack::_head() ## # Output the type of the current stack frame -shspec::stack::_head-type() +shspec:stack:_head-type() { - _shspec::stack::_headn 0 + _shspec:stack:_headn 0 } ## # Output the Nth datum of the current stack frame -_shspec::stack::_headn() +_shspec:stack:_headn() { local -ri i="$1" local parts - shspec::stack::_read -a parts <<< "$(shspec::stack::_head)" + shspec:stack:_read -a parts <<< "$(shspec:stack:_head)" echo "${parts[$i]}" } ## # Deconstruct stack frame from stdin in a `read`-like manner -shspec::stack::_read() +shspec:stack:_read() { IFS=\| read "$@" } @@ -125,10 +125,10 @@ shspec::stack::_read() # # Return immediately with a non-zero status if there are no frames on the # stack. -shspec::stack::_read-pop() +shspec:stack:_read-pop() { - local -r head="$(shspec::stack::_pop)" || return 1 - shspec::stack::_read "$@" <<< "$head" + local -r head="$(shspec:stack:_pop)" || return 1 + shspec:stack:_read "$@" <<< "$head" } @@ -137,7 +137,7 @@ shspec::stack::_read-pop() # # Conceptually, this allows determining if the parent node in a tree-like # structure is of a certain type. -shspec::stack::_assert-within() +shspec:stack:_assert-within() { local -r in="$1" local -r chk="$2" @@ -145,21 +145,21 @@ shspec::stack::_assert-within() local -r file="$4" local -r phrase="${5:-be contained within}" - local -r head="$(shspec::stack::_head-type)" + local -r head="$(shspec:stack:_head-type)" [ "$head" == "$in" ] \ - || shspec::bail \ + || shspec:bail \ "\`$chk' must $phrase \`$head'; found \`$head' at $file:$line" } ## -# Alias for shspec::stack::_assert-within with altered error message +# Alias for shspec:stack:_assert-within with altered error message # # This is intended to convey a different perspective: that a given node is a # sibling, not a child, in a tree-like structure. -shspec::stack::_assert-follow() +shspec:stack:_assert-follow() { - shspec::stack::_assert-within "$@" follow + shspec:stack:_assert-within "$@" follow } diff --git a/test/test-expect-core b/test/test-expect-core index ec055ef..397abf2 100644 --- a/test/test-expect-core +++ b/test/test-expect-core @@ -21,16 +21,16 @@ describe be it cannot stand alone - expect shspec::expect::be 0 2 + expect shspec:expect:be 0 2 to fail end it processes remainder clause as if it did not exist ( expected="foo bar baz" - shspec::expect::awesome() { shift "$2"; test "$*" == "$expected"; } + shspec:expect:awesome() { shift "$2"; test "$*" == "$expected"; } - expect shspec::expect::be 0 2 awesome $expected + expect shspec:expect:be 0 2 awesome $expected to succeed ) end @@ -39,12 +39,12 @@ end describe succeed it will succeed when command exits with status code 0 - expect shspec::expect::succeed 0 2 + expect shspec:expect:succeed 0 2 to succeed end it will fail when command exits with non-zero status code - expect shspec::expect::succeed 1 2 + expect shspec:expect:succeed 1 2 to fail end end @@ -52,12 +52,12 @@ end describe fail it will succeed when command exits with non-zero status code - expect shspec::expect::fail 1 2 + expect shspec:expect:fail 1 2 to succeed end it will fail when command exits with status code 0 - expect shspec::expect::fail 0 2 + expect shspec:expect:fail 0 2 to fail end end @@ -66,11 +66,11 @@ end describe not it will invert the result of an expectation # exit code of 1, so normally `succeed' would fail - expect shspec::expect::not 1 2 succeed + expect shspec:expect:not 1 2 succeed to succeed # exit code of 0, so normally `succeed' would succeed - expect shspec::expect::not 0 2 succeed + expect shspec:expect:not 0 2 succeed to fail end end @@ -78,50 +78,50 @@ end describe output it will default to asserting against stdout - expect shspec::expect::output 0 2 "test string" <<< "test string" + expect shspec:expect:output 0 2 "test string" <<< "test string" to succeed end # by convention, stderr file passed as third argument it can assert against stderr output { - expect shspec::expect::output 0 3 /dev/fd/3 \ + expect shspec:expect:output 0 3 /dev/fd/3 \ "test stderr" on stderr to succeed } 3< <( echo "test stderr" ) end it fails on stdout mismatch - expect shspec::expect::output 0 2 "foo" <<< "bar" + expect shspec:expect:output 0 2 "foo" <<< "bar" to fail end it fails on stderr mismatch { - expect shspec::expect::output 0 3 /dev/fd/3 "foo" on stderr + expect shspec:expect:output 0 3 /dev/fd/3 "foo" on stderr to fail } 3< <( echo bar ) end it ignores exit code - expect shspec::expect::output 1 2 "foo" <<< "foo" + expect shspec:expect:output 1 2 "foo" <<< "foo" to succeed end # as is good practice for Unix utilities it expects trailing newline by default - expect shspec::expect::output 0 2 "foo" < <( echo -n foo ) + expect shspec:expect:output 0 2 "foo" < <( echo -n foo ) to fail end it can disable trailing newline check with "'without newline'" clause - expect shspec::expect::output 0 2 "foo" without newline \ + expect shspec:expect:output 0 2 "foo" without newline \ < <( echo -n foo ) to succeed end it errors on any unrecognized clause - expect shspec::expect::output 0 2 "foo" fluffy bunnies <<< "foo" + expect shspec:expect:output 0 2 "foo" fluffy bunnies <<< "foo" to fail end end @@ -129,33 +129,33 @@ end describe match it will default to asserting against stdout - expect shspec::expect::match 0 2 "foo" <<< "foo" + expect shspec:expect:match 0 2 "foo" <<< "foo" to succeed end # by convention, stderr file passed as third argument it can assert against stderr output { - expect shspec::expect::match 0 3 /dev/fd/3 "stderr" on stderr + expect shspec:expect:match 0 3 /dev/fd/3 "stderr" on stderr to succeed } 3< <( echo "test stderr" ) end it ignores exit code - expect shspec::expect::match 1 2 "foo" <<< "foo" + expect shspec:expect:match 1 2 "foo" <<< "foo" to succeed end it will perform partial match - expect shspec::expect::match 0 2 "foo" <<< "contains foo" + expect shspec:expect:match 0 2 "foo" <<< "contains foo" to succeed end it will match against a pattern - expect shspec::expect::match 0 2 "^foo.*baz" <<< "foo bar baz" + expect shspec:expect:match 0 2 "^foo.*baz" <<< "foo bar baz" to succeed - expect shspec::expect::match 0 2 "^foo.*baz" <<< "bar foo bar baz" + expect shspec:expect:match 0 2 "^foo.*baz" <<< "bar foo bar baz" to fail end end @@ -164,32 +164,32 @@ end describe silent it succeeds when both stdout and stderr are empty # omitting stderr arg - expect shspec::expect::silent 0 2 < <(:) + expect shspec:expect:silent 0 2 < <(:) to succeed # empty stderr - expect shspec::expect::silent 0 3 <(:) < <(:) + expect shspec:expect:silent 0 3 <(:) < <(:) to succeed end it fails when stdout is empty but stderr is not - expect shspec::expect::silent 0 3 <( echo ) < <(:) + expect shspec:expect:silent 0 3 <( echo ) < <(:) to fail end it fails when stderr is empty but stdout is not # omitting stderr arg - expect shspec::expect::silent 0 2 <<< "" + expect shspec:expect:silent 0 2 <<< "" to fail # empty stderr - expect shspec::expect::silent 0 3 <(:) <<< "" + expect shspec:expect:silent 0 3 <(:) <<< "" to fail end # no arguments within context of the DSL, that is it accepts no arguments - expect shspec::expect::silent 0 2 foo < <(:) + expect shspec:expect:silent 0 2 foo < <(:) to fail end end diff --git a/test/test-expect-env b/test/test-expect-env index 0436997..e69221e 100644 --- a/test/test-expect-env +++ b/test/test-expect-env @@ -31,7 +31,7 @@ declare -- nonexport_empty=""' declare curchk function setchk() { - shspec::expect::$curchk 0 4 <(:) <( echo "$stubenv" ) "$@" + shspec:expect:$curchk 0 4 <(:) <( echo "$stubenv" ) "$@" } diff --git a/test/test-spec b/test/test-spec index 0b9b27b..033e154 100644 --- a/test/test-spec +++ b/test/test-spec @@ -38,9 +38,9 @@ test-run() } -describe shspec::begin-spec +describe shspec:begin-spec it is a placeholder that exits successfully - expect shspec::begin-spec + expect shspec:begin-spec to succeed end end @@ -179,7 +179,7 @@ describe expect it is provided premise exit code as first argument expect test-run <<< ' declare excode=123 - shspec::expect::chk() { test "$1" -eq $excode; } + shspec:expect:chk() { test "$1" -eq $excode; } describe foo it exposes exit code @@ -195,7 +195,7 @@ describe expect it is provided remainder clause after shift argument expect test-run <<< ' declare remain="a b c" - shspec::expect::chk() + shspec:expect:chk() { shift "$2" test "$*" == "$remain" @@ -213,7 +213,7 @@ describe expect it receives premise output via stdin expect test-run <<< ' declare str=foo - shspec::expect::chk() { test "$(cat)" == "$str"; } + shspec:expect:chk() { test "$(cat)" == "$str"; } describe foo it pipes command output @@ -228,7 +228,7 @@ describe expect # newline will be added; we don't want that! it does not have newline added to premise output if missing expect test-run <<< ' - shspec::expect::chk() { test "$( wc -c )" -eq 0; } + shspec:expect:chk() { test "$( wc -c )" -eq 0; } describe foo it should not add newline @@ -338,18 +338,18 @@ describe expect end - describe shspec::proxy-to + describe shspec:proxy-to it proxies remainder clause with variable shift length expect test-run <<< ' expected="foo bar baz" - shspec::expect::chk() { shift "$2"; test "$*" == "$expected"; } + shspec:expect:chk() { shift "$2"; test "$*" == "$expected"; } describe foo it should succeed - expect shspec::proxy-to 0 2 chk $expected + expect shspec:proxy-to 0 2 chk $expected to succeed - expect shspec::proxy-to 0 3 /dev/null chk $expected + expect shspec:proxy-to 0 3 /dev/null chk $expected to succeed end end