diff --git a/test/bats/github_13.bats b/test/bats/github_13.bats index 5ddd271..d218a7d 100644 --- a/test/bats/github_13.bats +++ b/test/bats/github_13.bats @@ -58,35 +58,31 @@ export GETOPTS_LONG_TEST_BIN='getopts_long-no_shortspec' } @test "${FEATURE}: terminator followed by long variable, silent" { - compare '-t -- -v user_val' \ + compare '-t -- -vuser_val' \ '--toggle -- --variable=user_val' \ - '/^\$@: /d' - expect "${bash_getopts[6]}" == 'declare -a $@=([0]="-v" [1]="user_val")' + '6{s/\[0]="(-v|--variable=)/[0]="-NORMALIZED=/}' + expect "${bash_getopts[6]}" == 'declare -a $@=([0]="-vuser_val")' expect "${getopts_long[6]}" == 'declare -a $@=([0]="--variable=user_val")' } @test "${FEATURE}: terminator followed by long variable, verbose" { - compare '-t -- -v user_val' \ + compare '-t -- -vuser_val' \ '--toggle -- --variable=user_val' \ - '/^\$@: /d' - expect "${bash_getopts[6]}" == 'declare -a $@=([0]="-v" [1]="user_val")' + '6{s/\[0]="(-v|--variable=)/[0]="-NORMALIZED=/}' + expect "${bash_getopts[6]}" == 'declare -a $@=([0]="-vuser_val")' expect "${getopts_long[6]}" == 'declare -a $@=([0]="--variable=user_val")' } @test "${FEATURE}: long variable followed by terminator, silent" { - compare '-v user_val -- -t' \ + compare '-vuser_val -- -t' \ '--variable=user_val -- --toggle' \ - '/^(OPTIND|\$@): /d' - expect "${bash_getopts[5]}" == 'declare -i OPTIND="4"' - expect "${getopts_long[5]}" == 'declare -i OPTIND="3"' + '6{s/\[0]="(-t|--toggle)"/[0]="NORMALIZED"/}' expect "${bash_getopts[6]}" == 'declare -a $@=([0]="-t")' expect "${getopts_long[6]}" == 'declare -a $@=([0]="--toggle")' } @test "${FEATURE}: long variable followed by terminator, verbose" { - compare '-v user_val -- -t' \ + compare '-vuser_val -- -t' \ '--variable=user_val -- --toggle' \ - '/^(OPTIND|\$@): /d' - expect "${bash_getopts[5]}" == 'declare -i OPTIND="4"' - expect "${getopts_long[5]}" == 'declare -i OPTIND="3"' + '6{s/\[0]="(-t|--toggle)"/[0]="NORMALIZED"/}' expect "${bash_getopts[6]}" == 'declare -a $@=([0]="-t")' expect "${getopts_long[6]}" == 'declare -a $@=([0]="--toggle")' } diff --git a/test/bin/getopts_long-explicit_args-silent b/test/bin/getopts_long-explicit_args-silent index 6fe2eca..9f11d7b 100755 --- a/test/bin/getopts_long-explicit_args-silent +++ b/test/bin/getopts_long-explicit_args-silent @@ -39,7 +39,8 @@ getopts_function() { local function_args=("$@") declare -p function_args \ - | sed -e 's/script_args/$@/' | grep -oe 'declare.*' + | sed -e 's/function_args/$@/' \ + | grep -oe 'declare.*' } proxy() { diff --git a/test/bin/getopts_long-explicit_args-verbose b/test/bin/getopts_long-explicit_args-verbose index 9687279..3edda6d 100755 --- a/test/bin/getopts_long-explicit_args-verbose +++ b/test/bin/getopts_long-explicit_args-verbose @@ -39,7 +39,8 @@ getopts_function() { local function_args=("$@") declare -p function_args \ - | sed -e 's/script_args/$@/' | grep -oe 'declare.*' + | sed -e 's/function_args/$@/' \ + | grep -oe 'declare.*' } proxy() {