summaryrefslogtreecommitdiff
path: root/testsuite/bc.tests
diff options
context:
space:
mode:
authorDenys Vlasenko2018-12-17 16:54:37 +0100
committerDenys Vlasenko2018-12-17 17:00:29 +0100
commit4b72aebe80aaa50a765d5ff61d7d67ed731502d9 (patch)
treed922437e5da9bf034d78622dc2f5b1e0e0f539db /testsuite/bc.tests
parentb44a7f1d6642e2da39e9f27e0b504f662ca443a2 (diff)
downloadbusybox-4b72aebe80aaa50a765d5ff61d7d67ed731502d9.zip
busybox-4b72aebe80aaa50a765d5ff61d7d67ed731502d9.tar.gz
bc: remove "error after expression parsing" check
It is misplaced: caller knows better what can or cannot follow the expression. Sometimes even caller's caller: "if (1) return a+b else..." - parser of "return" does not know that "else" after it is valid, parser of stmt does not know it either, - only parser of "if" knows it! The removed code balked on e.g. "{ print 1 }" statement. This does not break any valid programs, but starts accepting some invalid ones, e.g. "print 1 print 2" would work. function old new delta zcommon_parse_expr 40 32 -8 zbc_parse_name 509 494 -15 zbc_parse_stmt_possibly_auto 1678 1638 -40 bc_parse_expr_empty_ok 2025 1977 -48 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-111) Total: -111 bytes text data bss dec hex filename 981599 485 7296 989380 f18c4 busybox_old 981488 485 7296 989269 f1855 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite/bc.tests')
-rwxr-xr-xtestsuite/bc.tests5
1 files changed, 5 insertions, 0 deletions
diff --git a/testsuite/bc.tests b/testsuite/bc.tests
index d057bea..e0a45a8 100755
--- a/testsuite/bc.tests
+++ b/testsuite/bc.tests
@@ -76,6 +76,11 @@ testing "bc print 1,2,3" \
"123" \
"" "print 1,2,3"
+testing "bc { print 1 }" \
+ "bc" \
+ "1" \
+ "" "{ print 1 }"
+
testing "bc nested loops and breaks" \
"bc" \
"\