diff options
author | Brian Foley <bpfoley@google.com> | 2019-09-05 10:46:22 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2019-10-21 16:54:40 +0200 |
commit | 4699b932446f809d747d97f8e24b5d48608f7276 (patch) | |
tree | 5d761ac8e1b891871ddf6d96490e28df541bc945 /testsuite | |
parent | 244c0ebb4f71fb9f400d2242bbdeaca0c138c547 (diff) | |
download | busybox-w32-4699b932446f809d747d97f8e24b5d48608f7276.tar.gz busybox-w32-4699b932446f809d747d97f8e24b5d48608f7276.tar.bz2 busybox-w32-4699b932446f809d747d97f8e24b5d48608f7276.zip |
dc: execute shouldn't pop if stack head is not a string
This matches the behaviour of both GNU dc (as specified in
its man page), and BSD dc (where stack_popstring() pops
only if the head is a string.)
Add a couple of tests to verify this behavior.
function old new delta
zxc_vm_process 6882 6884 +2
Signed-off-by: Brian Foley <bpfoley@google.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/dc.tests | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/testsuite/dc.tests b/testsuite/dc.tests index 8c3af4156..f74e3f0f5 100755 --- a/testsuite/dc.tests +++ b/testsuite/dc.tests | |||
@@ -44,6 +44,16 @@ testing "dc complex without spaces (multiple args)" \ | |||
44 | optional FEATURE_DC_BIG | 44 | optional FEATURE_DC_BIG |
45 | # All tests below depend on FEATURE_DC_BIG | 45 | # All tests below depend on FEATURE_DC_BIG |
46 | 46 | ||
47 | testing "dc: x should execute strings" \ | ||
48 | "dc -e'[40 2 +] x f'" \ | ||
49 | "42\n" \ | ||
50 | "" "" | ||
51 | |||
52 | testing "dc: x should not execute or pop non-strings" \ | ||
53 | "dc -e'42 x f'" \ | ||
54 | "42\n" \ | ||
55 | "" "" | ||
56 | |||
47 | testing "dc read" \ | 57 | testing "dc read" \ |
48 | "dc -finput" \ | 58 | "dc -finput" \ |
49 | "2\n9\n1\n" \ | 59 | "2\n9\n1\n" \ |