aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2015-02-16 17:12:04 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2015-02-16 17:12:04 +0100
commit70e30e8eec7f202cb584449e4c7a9176d57d980d (patch)
treef502c4819933beeb15d1ad50c0f335318495fa25 /testsuite
parent8e92df15b512d108901ce1762e917518553a8aaf (diff)
downloadbusybox-w32-70e30e8eec7f202cb584449e4c7a9176d57d980d.tar.gz
busybox-w32-70e30e8eec7f202cb584449e4c7a9176d57d980d.tar.bz2
busybox-w32-70e30e8eec7f202cb584449e4c7a9176d57d980d.zip
dc: tweak parsing
https://bugs.debian.org/538685 dc requires whitespace between language elements. We were requiring 1 2 + p instead of the abbreviated 1 2+p (for example). function old new delta stack_machine 97 126 +29 dc_main 117 79 -38 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 29/-38) Total: -9 bytes Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/dc.tests56
1 files changed, 56 insertions, 0 deletions
diff --git a/testsuite/dc.tests b/testsuite/dc.tests
new file mode 100755
index 000000000..a5da5372d
--- /dev/null
+++ b/testsuite/dc.tests
@@ -0,0 +1,56 @@
1#!/bin/sh
2# Copyright 2015 by Bernhard Reutner-Fischer
3# Licensed under GPLv2 or later, see file LICENSE in this source tree.
4
5. ./testing.sh
6
7# testing "test name" "command" "expected result" "file input" "stdin"
8
9testing "dc basic syntax (stdin, multiple args)" \
10 "dc" \
11 "30\n" \
12 "" "10 20+p"
13
14testing "dc basic syntax (argv, single arg)" \
15 "dc '10 20+p'" \
16 "30\n" \
17 "" ""
18
19testing "dc basic syntax (argv, multiple args)" \
20 "dc 10 20+p" \
21 "30\n" \
22 "" ""
23
24testing "dc complex with spaces (single arg)" \
25 "dc '8 8 * 2 2 + / p'" \
26 "16\n" \
27 "" ""
28
29testing "dc complex without spaces (single arg)" \
30 "dc '8 8*2 2+/p'" \
31 "16\n" \
32 "" ""
33
34testing "dc complex with spaces (multiple args)" \
35 "dc 8 8 \* 2 2 + / p" \
36 "16\n" \
37 "" ""
38
39testing "dc complex without spaces (multiple args)" \
40 "dc 8 8\*2 2+/p" \
41 "16\n" \
42 "" ""
43
44exit $FAILCOUNT
45
46# we do not support arguments
47testing "dc -e <exprs>" \
48 "dc -e '10 2+f'" \
49 "12\n" \
50 "" ""
51
52testing "dc -f <exprs-from-given-file>" \
53 "dc -f input" \
54 "12\n" \
55 "10 2+f" ""
56