summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-12-06 18:46:42 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-12-06 18:46:42 +0100
commita1331371748fe23ffaec0720f5c5f4f661c37789 (patch)
tree55462e528d52c97b91744c969034318569c04810
parent6d0be10aae1fb92879269e4397ae4e7ab037a628 (diff)
downloadbusybox-w32-a1331371748fe23ffaec0720f5c5f4f661c37789.tar.gz
busybox-w32-a1331371748fe23ffaec0720f5c5f4f661c37789.tar.bz2
busybox-w32-a1331371748fe23ffaec0720f5c5f4f661c37789.zip
dc: fix testsuite
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--miscutils/dc.c1
-rwxr-xr-xtestsuite/dc.tests24
2 files changed, 7 insertions, 18 deletions
diff --git a/miscutils/dc.c b/miscutils/dc.c
index 22890147d..bca4778bf 100644
--- a/miscutils/dc.c
+++ b/miscutils/dc.c
@@ -248,6 +248,7 @@ int dc_main(int argc UNUSED_PARAM, char **argv)
248{ 248{
249 INIT_G(); 249 INIT_G();
250 250
251//TODO: fix this, should take: dc -eSCRIPT -fFILE FILE
251 argv++; 252 argv++;
252 if (!argv[0]) { 253 if (!argv[0]) {
253 /* take stuff from stdin if no args are given */ 254 /* take stuff from stdin if no args are given */
diff --git a/testsuite/dc.tests b/testsuite/dc.tests
index a5da5372d..d7a332b9c 100755
--- a/testsuite/dc.tests
+++ b/testsuite/dc.tests
@@ -12,45 +12,33 @@ testing "dc basic syntax (stdin, multiple args)" \
12 "" "10 20+p" 12 "" "10 20+p"
13 13
14testing "dc basic syntax (argv, single arg)" \ 14testing "dc basic syntax (argv, single arg)" \
15 "dc '10 20+p'" \ 15 "dc -e'10 20+p'" \
16 "30\n" \ 16 "30\n" \
17 "" "" 17 "" ""
18 18
19testing "dc basic syntax (argv, multiple args)" \ 19testing "dc basic syntax (argv, multiple args)" \
20 "dc 10 20+p" \ 20 "dc -e10 -e20+p" \
21 "30\n" \ 21 "30\n" \
22 "" "" 22 "" ""
23 23
24testing "dc complex with spaces (single arg)" \ 24testing "dc complex with spaces (single arg)" \
25 "dc '8 8 * 2 2 + / p'" \ 25 "dc -e'8 8 * 2 2 + / p'" \
26 "16\n" \ 26 "16\n" \
27 "" "" 27 "" ""
28 28
29testing "dc complex without spaces (single arg)" \ 29testing "dc complex without spaces (single arg)" \
30 "dc '8 8*2 2+/p'" \ 30 "dc -e'8 8*2 2+/p'" \
31 "16\n" \ 31 "16\n" \
32 "" "" 32 "" ""
33 33
34testing "dc complex with spaces (multiple args)" \ 34testing "dc complex with spaces (multiple args)" \
35 "dc 8 8 \* 2 2 + / p" \ 35 "dc -e8 -e8 -e\* -e2 -e2 -e+ -e/ -ep" \
36 "16\n" \ 36 "16\n" \
37 "" "" 37 "" ""
38 38
39testing "dc complex without spaces (multiple args)" \ 39testing "dc complex without spaces (multiple args)" \
40 "dc 8 8\*2 2+/p" \ 40 "dc -e8 -e8\*2 -e2+/p" \
41 "16\n" \ 41 "16\n" \
42 "" "" 42 "" ""
43 43
44exit $FAILCOUNT 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