diff options
author | Gavin Howard <gavin@yzena.com> | 2021-07-22 13:54:52 -0600 |
---|---|---|
committer | Gavin Howard <gavin@yzena.com> | 2021-07-22 13:56:03 -0600 |
commit | 6e46f47b0a0838afd8615296f73517cc1c7b7f53 (patch) | |
tree | 6df7083785de01dc09e4d54941115fdc43a57828 /tests | |
parent | 17acc3ec92e9565e2f79ab1ba8c3f4882ae16c6f (diff) | |
download | platform_external_bc-6e46f47b0a0838afd8615296f73517cc1c7b7f53.tar.gz platform_external_bc-6e46f47b0a0838afd8615296f73517cc1c7b7f53.tar.bz2 platform_external_bc-6e46f47b0a0838afd8615296f73517cc1c7b7f53.zip |
Add bc's prohibition against redefining in the builtin libs to a test
Signed-off-by: Gavin Howard <gavin@yzena.com>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/all.sh | 2 | ||||
-rwxr-xr-x | tests/other.sh | 19 |
2 files changed, 16 insertions, 5 deletions
diff --git a/tests/all.sh b/tests/all.sh index 973f03b9..04afdb39 100755 --- a/tests/all.sh +++ b/tests/all.sh @@ -127,7 +127,7 @@ sh "$testdir/read.sh" "$d" "$exe" "$@" sh "$testdir/errors.sh" "$d" "$exe" "$@" # Other tests. -sh "$testdir/other.sh" "$d" "$exe" "$@" +sh "$testdir/other.sh" "$d" "$extra" "$exe" "$@" printf '\nAll %s tests passed.\n' "$d" diff --git a/tests/other.sh b/tests/other.sh index 398a5a1c..0a856f4a 100755 --- a/tests/other.sh +++ b/tests/other.sh @@ -35,11 +35,16 @@ testdir=$(dirname "$script") . "$testdir/../scripts/functions.sh" # Command-line processing. -if [ "$#" -ge 1 ]; then +if [ "$#" -ge 2 ]; then + d="$1" shift + + extra_math="$1" + shift + else - err_exit "usage: $script dir [exec args...]" 1 + err_exit "usage: $script dir extra_math [exec args...]" 1 fi if [ "$#" -lt 1 ]; then @@ -145,12 +150,18 @@ if [ "$d" = "bc" ]; then checktest "$d" "$err" "keyword redefinition" "$redefine_res" "$redefine_out" - printf '5\n0\n' > "$redefine_res" - "$exe" "$@" -r "abs" -r "else" -e 'abs = 5;else = 0' -e 'abs;else' > "$redefine_out" checktest "$d" "$err" "keyword redefinition" "$redefine_res" "$redefine_out" + if [ "$extra_math" -ne 0 ]; then + + "$exe" "$@" -lr abs -e "perm(5, 1)" -e "0" > "$redefine_out" + + checktest "$d" "$err" "keyword not redefined in builtin library" "$redefine_res" "$redefine_out" + + fi + "$exe" "$@" -r "break" -e 'define break(x) { x }' 2> "$redefine_out" err="$?" |