diff --git a/test/bats/github_13.bats b/test/bats/github_13.bats index 673ec34..cbb3ea0 100644 --- a/test/bats/github_13.bats +++ b/test/bats/github_13.bats @@ -61,15 +61,15 @@ export GETOPTS_LONG_TEST_BIN='getopts_long-no_shortspec' compare '-t -- -v user_val' \ '--toggle -- --variable=user_val' \ '/^\$@: /d' - expect "${bash_getopts[6]}" == '$@: -v user_val' - expect "${getopts_long[6]}" == '$@: --variable=user_val' + expect "${bash_getopts[6]}" == '$@: ([0]="-v" [1]="user_val")' + expect "${getopts_long[6]}" == '$@: ([0]="--variable=user_val")' } @test "${FEATURE}: terminator followed by long variable, verbose" { compare '-t -- -v user_val' \ '--toggle -- --variable=user_val' \ '/^\$@: /d' - expect "${bash_getopts[6]}" == '$@: -v user_val' - expect "${getopts_long[6]}" == '$@: --variable=user_val' + expect "${bash_getopts[6]}" == '$@: ([0]="-v" [1]="user_val")' + expect "${getopts_long[6]}" == '$@: ([0]="--variable=user_val")' } @test "${FEATURE}: long variable followed by terminator, silent" { @@ -78,8 +78,8 @@ export GETOPTS_LONG_TEST_BIN='getopts_long-no_shortspec' '/^(OPTIND|\$@): /d' expect "${bash_getopts[5]}" == 'OPTIND: 4' expect "${getopts_long[5]}" == 'OPTIND: 3' - expect "${bash_getopts[6]}" == '$@: -t' - expect "${getopts_long[6]}" == '$@: --toggle' + expect "${bash_getopts[6]}" == '$@: ([0]="-t")' + expect "${getopts_long[6]}" == '$@: ([0]="--toggle")' } @test "${FEATURE}: long variable followed by terminator, verbose" { compare '-v user_val -- -t' \ @@ -87,6 +87,6 @@ export GETOPTS_LONG_TEST_BIN='getopts_long-no_shortspec' '/^(OPTIND|\$@): /d' expect "${bash_getopts[5]}" == 'OPTIND: 4' expect "${getopts_long[5]}" == 'OPTIND: 3' - expect "${bash_getopts[6]}" == '$@: -t' - expect "${getopts_long[6]}" == '$@: --toggle' + expect "${bash_getopts[6]}" == '$@: ([0]="-t")' + expect "${getopts_long[6]}" == '$@: ([0]="--toggle")' } diff --git a/test/bats/invalid_arguments.bats b/test/bats/invalid_arguments.bats index 22e98a4..ca25a8c 100644 --- a/test/bats/invalid_arguments.bats +++ b/test/bats/invalid_arguments.bats @@ -55,13 +55,13 @@ load ../test_helper @test "${FEATURE}: short option, terminator, extra arguments, silent" { compare '-i -- user_arg' \ '-i -- user_arg' - expect "${getopts_long[6]}" == '$@: user_arg' + expect "${getopts_long[6]}" == '$@: ([0]="user_arg")' } @test "${FEATURE}: short option, terminator, extra arguments, verbose" { compare '-i -- user_arg' \ '-i -- user_arg' \ 's/getopts_long-verbose/getopts-verbose/g' - expect "${getopts_long[7]}" == '$@: user_arg' + expect "${getopts_long[7]}" == '$@: ([0]="user_arg")' } @test "${FEATURE}: long option, terminator, extra arguments, silent" { @@ -70,13 +70,13 @@ load ../test_helper '/^INVALID OPTION -- /d' expect "${bash_getopts[1]}" == 'INVALID OPTION -- OPTARG="i"' expect "${getopts_long[1]}" == 'INVALID OPTION -- OPTARG="invalid"' - expect "${getopts_long[6]}" == '$@: user_arg' + expect "${getopts_long[6]}" == '$@: ([0]="user_arg")' } @test "${FEATURE}: long option, terminator, extra arguments, verbose" { compare '-i -- user_arg' \ '--invalid -- user_arg' \ 's/getopts_long-verbose: (.*) invalid$/getopts-verbose: \1 i/g' - expect "${getopts_long[7]}" == '$@: user_arg' + expect "${getopts_long[7]}" == '$@: ([0]="user_arg")' } # terminator followed by options @@ -84,24 +84,24 @@ load ../test_helper @test "${FEATURE}: terminator, short option, extra arguments, silent" { compare '-- -i user_arg' \ '-- -i user_arg' - expect "${getopts_long[5]}" == '$@: -i user_arg' + expect "${getopts_long[5]}" == '$@: ([0]="-i" [1]="user_arg")' } @test "${FEATURE}: terminator, short option, extra arguments, verbose" { compare '-- -i user_arg' \ '-- -i user_arg' \ 's/getopts_long-verbose/getopts-verbose/g' - expect "${getopts_long[5]}" == '$@: -i user_arg' + expect "${getopts_long[5]}" == '$@: ([0]="-i" [1]="user_arg")' } @test "${FEATURE}: terminator, long option, extra arguments, silent" { compare '-- -i user_arg' \ '-- --invalid user_arg' \ '/^\$@: /d' - expect "${getopts_long[5]}" == '$@: --invalid user_arg' + expect "${getopts_long[5]}" == '$@: ([0]="--invalid" [1]="user_arg")' } @test "${FEATURE}: terminator, long option, extra arguments, verbose" { compare '-- -i user_arg' \ '-- --invalid user_arg' \ '/^\$@: /d' - expect "${getopts_long[5]}" == '$@: --invalid user_arg' + expect "${getopts_long[5]}" == '$@: ([0]="--invalid" [1]="user_arg")' } diff --git a/test/bats/no_arguments.bats b/test/bats/no_arguments.bats index 5dcdd9f..6d75bdf 100644 --- a/test/bats/no_arguments.bats +++ b/test/bats/no_arguments.bats @@ -21,10 +21,10 @@ load ../test_helper @test "${FEATURE}: terminator, extra arguments, silent" { compare '-- user_arg' \ '-- user_arg' - expect "${getopts_long[5]}" == '$@: user_arg' + expect "${getopts_long[5]}" == '$@: ([0]="user_arg")' } @test "${FEATURE}: terminator, extra arguments, verbose" { compare '-- user_arg' \ '-- user_arg' - expect "${getopts_long[5]}" == '$@: user_arg' + expect "${getopts_long[5]}" == '$@: ([0]="user_arg")' } diff --git a/test/bats/option_supplied.bats b/test/bats/option_supplied.bats index 5cdd9f7..df12718 100644 --- a/test/bats/option_supplied.bats +++ b/test/bats/option_supplied.bats @@ -45,23 +45,23 @@ load ../test_helper @test "${FEATURE}: short option, terminator, extra arguments, silent" { compare '-o user_val -- user_arg' \ '-o user_val -- user_arg' - expect "${getopts_long[6]}" == '$@: user_arg' + expect "${getopts_long[6]}" == '$@: ([0]="user_arg")' } @test "${FEATURE}: short option, terminator, extra arguments, verbose" { compare '-o user_val -- user_arg' \ '-o user_val -- user_arg' - expect "${getopts_long[6]}" == '$@: user_arg' + expect "${getopts_long[6]}" == '$@: ([0]="user_arg")' } @test "${FEATURE}: long option, terminator, extra arguments, silent" { compare '-o user_val -- user_arg' \ '--option user_val -- user_arg' - expect "${getopts_long[6]}" == '$@: user_arg' + expect "${getopts_long[6]}" == '$@: ([0]="user_arg")' } @test "${FEATURE}: long option, terminator, extra arguments, verbose" { compare '-o user_val -- user_arg' \ '--option user_val -- user_arg' - expect "${getopts_long[6]}" == '$@: user_arg' + expect "${getopts_long[6]}" == '$@: ([0]="user_arg")' } # multiple same arguments @@ -97,25 +97,25 @@ load ../test_helper @test "${FEATURE}: terminator, short option, extra arguments, silent" { compare '-- -o user_val user_arg' \ '-- -o user_val user_arg' - expect "${getopts_long[5]}" == '$@: -o user_val user_arg' + expect "${getopts_long[5]}" == '$@: ([0]="-o" [1]="user_val" [2]="user_arg")' } @test "${FEATURE}: terminator, short option, extra arguments, verbose" { compare '-- -o user_val user_arg' \ '-- -o user_val user_arg' - expect "${getopts_long[5]}" == '$@: -o user_val user_arg' + expect "${getopts_long[5]}" == '$@: ([0]="-o" [1]="user_val" [2]="user_arg")' } @test "${FEATURE}: terminator, long option, extra arguments, silent" { compare '-- -o user_val user_arg' \ '-- --option user_val user_arg' \ '/^\$@: /d' - expect "${getopts_long[5]}" == '$@: --option user_val user_arg' + expect "${getopts_long[5]}" == '$@: ([0]="--option" [1]="user_val" [2]="user_arg")' } @test "${FEATURE}: terminator, long option, extra arguments, verbose" { compare '-- -o user_val user_arg' \ '-- --option user_val user_arg' \ '/^\$@: /d' - expect "${getopts_long[5]}" == '$@: --option user_val user_arg' + expect "${getopts_long[5]}" == '$@: ([0]="--option" [1]="user_val" [2]="user_arg")' } # option without an argument diff --git a/test/bats/toggle_triggered.bats b/test/bats/toggle_triggered.bats index f9403d8..7f60ffe 100644 --- a/test/bats/toggle_triggered.bats +++ b/test/bats/toggle_triggered.bats @@ -45,23 +45,23 @@ load ../test_helper @test "${FEATURE}: short option, terminator, extra arguments, silent" { compare '-t -- user_arg' \ '-t -- user_arg' - expect "${getopts_long[6]}" == '$@: user_arg' + expect "${getopts_long[6]}" == '$@: ([0]="user_arg")' } @test "${FEATURE}: short option, terminator, extra arguments, verbose" { compare '-t -- user_arg' \ '-t -- user_arg' - expect "${getopts_long[6]}" == '$@: user_arg' + expect "${getopts_long[6]}" == '$@: ([0]="user_arg")' } @test "${FEATURE}: long option, terminator, extra arguments, silent" { compare '-t -- user_arg' \ '--toggle -- user_arg' - expect "${getopts_long[6]}" == '$@: user_arg' + expect "${getopts_long[6]}" == '$@: ([0]="user_arg")' } @test "${FEATURE}: long option, terminator, extra arguments, verbose" { compare '-t -- user_arg' \ '--toggle -- user_arg' - expect "${getopts_long[6]}" == '$@: user_arg' + expect "${getopts_long[6]}" == '$@: ([0]="user_arg")' } # multiple same arguments @@ -97,23 +97,23 @@ load ../test_helper @test "${FEATURE}: terminator, short option, extra arguments, silent" { compare '-- -t user_arg' \ '-- -t user_arg' - expect "${getopts_long[5]}" == '$@: -t user_arg' + expect "${getopts_long[5]}" == '$@: ([0]="-t" [1]="user_arg")' } @test "${FEATURE}: terminator, short option, extra arguments, verbose" { compare '-- -t user_arg' \ '-- -t user_arg' - expect "${getopts_long[5]}" == '$@: -t user_arg' + expect "${getopts_long[5]}" == '$@: ([0]="-t" [1]="user_arg")' } @test "${FEATURE}: terminator, long option, extra arguments, silent" { compare '-- -t user_arg' \ '-- --toggle user_arg' \ '/^\$@: /d' - expect "${getopts_long[5]}" == '$@: --toggle user_arg' + expect "${getopts_long[5]}" == '$@: ([0]="--toggle" [1]="user_arg")' } @test "${FEATURE}: terminator, long option, extra arguments, verbose" { compare '-- -t user_arg' \ '-- --toggle user_arg' \ '/^\$@: /d' - expect "${getopts_long[5]}" == '$@: --toggle user_arg' + expect "${getopts_long[5]}" == '$@: ([0]="--toggle" [1]="user_arg")' } diff --git a/test/bats/value_supplied.bats b/test/bats/value_supplied.bats index e56224c..096631c 100644 --- a/test/bats/value_supplied.bats +++ b/test/bats/value_supplied.bats @@ -57,19 +57,19 @@ load ../test_helper @test "${FEATURE}: short option, terminator, extra arguments, silent" { compare '-v user_val -- user_arg' \ '-v user_val -- user_arg' - expect "${getopts_long[6]}" == '$@: user_arg' + expect "${getopts_long[6]}" == '$@: ([0]="user_arg")' } @test "${FEATURE}: short option, terminator, extra arguments, verbose" { compare '-v user_val -- user_arg' \ '-v user_val -- user_arg' - expect "${getopts_long[6]}" == '$@: user_arg' + expect "${getopts_long[6]}" == '$@: ([0]="user_arg")' } @test "${FEATURE}: long option, terminator, extra arguments, silent" { compare '-v user_val -- user_arg' \ '--variable=user_val -- user_arg' \ '/^OPTIND: /d' - expect "${getopts_long[6]}" == '$@: user_arg' + expect "${getopts_long[6]}" == '$@: ([0]="user_arg")' expect "${bash_getopts[5]}" == 'OPTIND: 4' expect "${getopts_long[5]}" == 'OPTIND: 3' } @@ -77,7 +77,7 @@ load ../test_helper compare '-v user_val -- user_arg' \ '--variable=user_val -- user_arg' \ '/^OPTIND: /d' - expect "${getopts_long[6]}" == '$@: user_arg' + expect "${getopts_long[6]}" == '$@: ([0]="user_arg")' expect "${bash_getopts[5]}" == 'OPTIND: 4' expect "${getopts_long[5]}" == 'OPTIND: 3' } @@ -121,25 +121,25 @@ load ../test_helper @test "${FEATURE}: terminator, short option, extra arguments, silent" { compare '-- -v user_val user_arg' \ '-- -v user_val user_arg' - expect "${getopts_long[5]}" == '$@: -v user_val user_arg' + expect "${getopts_long[5]}" == '$@: ([0]="-v" [1]="user_val" [2]="user_arg")' } @test "${FEATURE}: terminator, short option, extra arguments, verbose" { compare '-- -v user_val user_arg' \ '-- -v user_val user_arg' - expect "${getopts_long[5]}" == '$@: -v user_val user_arg' + expect "${getopts_long[5]}" == '$@: ([0]="-v" [1]="user_val" [2]="user_arg")' } @test "${FEATURE}: terminator, long option, extra arguments, silent" { compare '-- -v user_val user_arg' \ '-- --variable=user_val user_arg' \ '/^\$@: /d' - expect "${getopts_long[5]}" == '$@: --variable=user_val user_arg' + expect "${getopts_long[5]}" == '$@: ([0]="--variable=user_val" [1]="user_arg")' } @test "${FEATURE}: terminator, long option, extra arguments, verbose" { compare '-- -v user_val user_arg' \ '-- --variable=user_val user_arg' \ '/^\$@: /d' - expect "${getopts_long[5]}" == '$@: --variable=user_val user_arg' + expect "${getopts_long[5]}" == '$@: ([0]="--variable=user_val" [1]="user_arg")' } # variable without an argument diff --git a/test/bin/getopts-silent b/test/bin/getopts-silent index a09a416..72e3ebe 100755 --- a/test/bin/getopts-silent +++ b/test/bin/getopts-silent @@ -31,4 +31,6 @@ echo "OPTERR: ${OPTERR}" echo "OPTKEY: ${OPTKEY}" echo "OPTARG: ${OPTARG}" echo "OPTIND: ${OPTIND}" -echo "\$@: ${*}" + +args=("$@") +declare -p args | sed -e 's/declare -a args=/$@: /' diff --git a/test/bin/getopts-verbose b/test/bin/getopts-verbose index bf2e87f..bd7d573 100755 --- a/test/bin/getopts-verbose +++ b/test/bin/getopts-verbose @@ -28,4 +28,6 @@ echo "OPTERR: ${OPTERR}" echo "OPTKEY: ${OPTKEY}" echo "OPTARG: ${OPTARG}" echo "OPTIND: ${OPTIND}" -echo "\$@: ${*}" + +args=("$@") +declare -p args | sed -e 's/declare -a args=/$@: /' diff --git a/test/bin/getopts_long-github_26-silent b/test/bin/getopts_long-github_26-silent index 5235b04..f55ea60 100755 --- a/test/bin/getopts_long-github_26-silent +++ b/test/bin/getopts_long-github_26-silent @@ -35,4 +35,6 @@ echo "OPTERR: ${OPTERR}" echo "OPTKEY: ${OPTKEY}" echo "OPTARG: ${OPTARG}" echo "OPTIND: ${OPTIND}" -echo "\$@: ${*}" + +args=("$@") +declare -p args | sed -e 's/declare -a args=/$@: /' diff --git a/test/bin/getopts_long-github_26-verbose b/test/bin/getopts_long-github_26-verbose index ee3bd9e..caeae38 100755 --- a/test/bin/getopts_long-github_26-verbose +++ b/test/bin/getopts_long-github_26-verbose @@ -32,4 +32,6 @@ echo "OPTERR: ${OPTERR}" echo "OPTKEY: ${OPTKEY}" echo "OPTARG: ${OPTARG}" echo "OPTIND: ${OPTIND}" -echo "\$@: ${*}" + +args=("$@") +declare -p args | sed -e 's/declare -a args=/$@: /' diff --git a/test/bin/getopts_long-longspec_with_dash-silent b/test/bin/getopts_long-longspec_with_dash-silent index 89a2a61..7473650 100755 --- a/test/bin/getopts_long-longspec_with_dash-silent +++ b/test/bin/getopts_long-longspec_with_dash-silent @@ -35,4 +35,6 @@ echo "OPTERR: ${OPTERR}" echo "OPTKEY: ${OPTKEY}" echo "OPTARG: ${OPTARG}" echo "OPTIND: ${OPTIND}" -echo "\$@: ${*}" + +args=("$@") +declare -p args | sed -e 's/declare -a args=/$@: /' diff --git a/test/bin/getopts_long-longspec_with_dash-verbose b/test/bin/getopts_long-longspec_with_dash-verbose index d3de453..2d6c9b7 100755 --- a/test/bin/getopts_long-longspec_with_dash-verbose +++ b/test/bin/getopts_long-longspec_with_dash-verbose @@ -32,4 +32,6 @@ echo "OPTERR: ${OPTERR}" echo "OPTKEY: ${OPTKEY}" echo "OPTARG: ${OPTARG}" echo "OPTIND: ${OPTIND}" -echo "\$@: ${*}" + +args=("$@") +declare -p args | sed -e 's/declare -a args=/$@: /' diff --git a/test/bin/getopts_long-longspec_with_dash_colon-silent b/test/bin/getopts_long-longspec_with_dash_colon-silent index f184c98..19f080e 100755 --- a/test/bin/getopts_long-longspec_with_dash_colon-silent +++ b/test/bin/getopts_long-longspec_with_dash_colon-silent @@ -35,4 +35,6 @@ echo "OPTERR: ${OPTERR}" echo "OPTKEY: ${OPTKEY}" echo "OPTARG: ${OPTARG}" echo "OPTIND: ${OPTIND}" -echo "\$@: ${*}" + +args=("$@") +declare -p args | sed -e 's/declare -a args=/$@: /' diff --git a/test/bin/getopts_long-longspec_with_dash_colon-verbose b/test/bin/getopts_long-longspec_with_dash_colon-verbose index d3ca005..68d624f 100755 --- a/test/bin/getopts_long-longspec_with_dash_colon-verbose +++ b/test/bin/getopts_long-longspec_with_dash_colon-verbose @@ -32,4 +32,6 @@ echo "OPTERR: ${OPTERR}" echo "OPTKEY: ${OPTKEY}" echo "OPTARG: ${OPTARG}" echo "OPTIND: ${OPTIND}" -echo "\$@: ${*}" + +args=("$@") +declare -p args | sed -e 's/declare -a args=/$@: /' diff --git a/test/bin/getopts_long-no_shortspec-silent b/test/bin/getopts_long-no_shortspec-silent index a7af5d2..68600fc 100755 --- a/test/bin/getopts_long-no_shortspec-silent +++ b/test/bin/getopts_long-no_shortspec-silent @@ -35,4 +35,6 @@ echo "OPTERR: ${OPTERR}" echo "OPTKEY: ${OPTKEY}" echo "OPTARG: ${OPTARG}" echo "OPTIND: ${OPTIND}" -echo "\$@: ${*}" + +args=("$@") +declare -p args | sed -e 's/declare -a args=/$@: /' diff --git a/test/bin/getopts_long-no_shortspec-verbose b/test/bin/getopts_long-no_shortspec-verbose index 04333a3..ca85f17 100755 --- a/test/bin/getopts_long-no_shortspec-verbose +++ b/test/bin/getopts_long-no_shortspec-verbose @@ -32,4 +32,6 @@ echo "OPTERR: ${OPTERR}" echo "OPTKEY: ${OPTKEY}" echo "OPTARG: ${OPTARG}" echo "OPTIND: ${OPTIND}" -echo "\$@: ${*}" + +args=("$@") +declare -p args | sed -e 's/declare -a args=/$@: /' diff --git a/test/bin/getopts_long-shortspec_with_dash-silent b/test/bin/getopts_long-shortspec_with_dash-silent index 0669183..1bc4c71 100755 --- a/test/bin/getopts_long-shortspec_with_dash-silent +++ b/test/bin/getopts_long-shortspec_with_dash-silent @@ -35,4 +35,6 @@ echo "OPTERR: ${OPTERR}" echo "OPTKEY: ${OPTKEY}" echo "OPTARG: ${OPTARG}" echo "OPTIND: ${OPTIND}" -echo "\$@: ${*}" + +args=("$@") +declare -p args | sed -e 's/declare -a args=/$@: /' diff --git a/test/bin/getopts_long-shortspec_with_dash-verbose b/test/bin/getopts_long-shortspec_with_dash-verbose index 2796725..d0dd0e4 100755 --- a/test/bin/getopts_long-shortspec_with_dash-verbose +++ b/test/bin/getopts_long-shortspec_with_dash-verbose @@ -32,4 +32,6 @@ echo "OPTERR: ${OPTERR}" echo "OPTKEY: ${OPTKEY}" echo "OPTARG: ${OPTARG}" echo "OPTIND: ${OPTIND}" -echo "\$@: ${*}" + +args=("$@") +declare -p args | sed -e 's/declare -a args=/$@: /' diff --git a/test/bin/getopts_long-silent b/test/bin/getopts_long-silent index 751a762..b188b03 100755 --- a/test/bin/getopts_long-silent +++ b/test/bin/getopts_long-silent @@ -35,4 +35,6 @@ echo "OPTERR: ${OPTERR}" echo "OPTKEY: ${OPTKEY}" echo "OPTARG: ${OPTARG}" echo "OPTIND: ${OPTIND}" -echo "\$@: ${*}" + +args=("$@") +declare -p args | sed -e 's/declare -a args=/$@: /' diff --git a/test/bin/getopts_long-verbose b/test/bin/getopts_long-verbose index c6b76fa..5dfff29 100755 --- a/test/bin/getopts_long-verbose +++ b/test/bin/getopts_long-verbose @@ -32,4 +32,6 @@ echo "OPTERR: ${OPTERR}" echo "OPTKEY: ${OPTKEY}" echo "OPTARG: ${OPTARG}" echo "OPTIND: ${OPTIND}" -echo "\$@: ${*}" + +args=("$@") +declare -p args | sed -e 's/declare -a args=/$@: /'