File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -365,7 +365,11 @@ while getopts ":qhv-" OPTION; do
365365 exit 0
366366 ;;
367367 -)
368- [ $OPTIND -ge 1 ] && optind=$(( OPTIND - 1 )) || optind=$OPTIND
368+ if [ " $OPTIND " -ge 2 ]; then
369+ optind=$(( OPTIND - 1 ))
370+ else
371+ optind=$OPTIND
372+ fi
369373 eval OPTION=" \$ $optind "
370374 OPTARG=$( echo " $OPTION " | cut -d' =' -f2)
371375 OPTION=$( echo " $OPTION " | cut -d' =' -f1)
Original file line number Diff line number Diff line change @@ -216,21 +216,25 @@ teardown() {
216216 [ -z " ${output} " ]
217217}
218218
219- @test " 'has' prints version with --version and -v" {
220- # run $has --version
221- # [ "$status" -eq 0 ]
222- # [[ "${output}" =~ ^has\ version\ [0-9]+\.[0-9]+\.[0-9]+ ]]
219+ @test " 'has' prints version with --version" {
220+ run $has --version
221+ [ " $status " -eq 0 ]
222+ [[ " ${output} " =~ ^v[0-9]+\. [0-9]+\. [0-9]+ ]]
223+ }
223224
225+ @test " 'has' prints version with -v" {
224226 run $has -v
225227 [ " $status " -eq 0 ]
226228 [[ " ${output} " =~ ^v[0-9]+\. [0-9]+\. [0-9]+ ]]
227229}
228230
229- @test " 'has' prints help with --help and -h" {
230- # run $has --help
231- # [ "$status" -eq 0 ]
232- # [ "${lines[0]}" = 'Usage: has [OPTION] <command-names>...' ]
231+ @test " 'has' prints help with --help" {
232+ run $has --help
233+ [ " $status " -eq 0 ]
234+ __assert_usage
235+ }
233236
237+ @test " 'has' prints help with -h" {
234238 run $has -h
235239 [ " $status " -eq 0 ]
236240 __assert_usage
You can’t perform that action at this time.
0 commit comments