dc: fix testsuite

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2018-12-06 18:46:42 +01:00
parent 6d0be10aae
commit a133137174
2 changed files with 7 additions and 18 deletions

View File

@ -248,6 +248,7 @@ int dc_main(int argc UNUSED_PARAM, char **argv)
{
INIT_G();
//TODO: fix this, should take: dc -eSCRIPT -fFILE FILE
argv++;
if (!argv[0]) {
/* take stuff from stdin if no args are given */

View File

@ -12,45 +12,33 @@ testing "dc basic syntax (stdin, multiple args)" \
"" "10 20+p"
testing "dc basic syntax (argv, single arg)" \
"dc '10 20+p'" \
"dc -e'10 20+p'" \
"30\n" \
"" ""
testing "dc basic syntax (argv, multiple args)" \
"dc 10 20+p" \
"dc -e10 -e20+p" \
"30\n" \
"" ""
testing "dc complex with spaces (single arg)" \
"dc '8 8 * 2 2 + / p'" \
"dc -e'8 8 * 2 2 + / p'" \
"16\n" \
"" ""
testing "dc complex without spaces (single arg)" \
"dc '8 8*2 2+/p'" \
"dc -e'8 8*2 2+/p'" \
"16\n" \
"" ""
testing "dc complex with spaces (multiple args)" \
"dc 8 8 \* 2 2 + / p" \
"dc -e8 -e8 -e\* -e2 -e2 -e+ -e/ -ep" \
"16\n" \
"" ""
testing "dc complex without spaces (multiple args)" \
"dc 8 8\*2 2+/p" \
"dc -e8 -e8\*2 -e2+/p" \
"16\n" \
"" ""
exit $FAILCOUNT
# we do not support arguments
testing "dc -e <exprs>" \
"dc -e '10 2+f'" \
"12\n" \
"" ""
testing "dc -f <exprs-from-given-file>" \
"dc -f input" \
"12\n" \
"10 2+f" ""