Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/bin/sh Don't confuse more capable shells by writing op...



details:   https://anonhg.NetBSD.org/src/rev/a197bf0e2fed
branches:  trunk
changeset: 814608:a197bf0e2fed
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Mar 31 16:19:52 2016 +0000

description:
Don't confuse more capable shells by writing operator combinations
that could be interpreted as something different. That is, for our
shell +4++3 is just (+4)+(+3) and works fine. But others treat ++
as the increment operator.  Same for --. Sprinkle spaces to taste.
(from kre@)

diffstat:

 tests/bin/sh/t_arith.sh |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (30 lines):

diff -r cf03caf14e1a -r a197bf0e2fed tests/bin/sh/t_arith.sh
--- a/tests/bin/sh/t_arith.sh   Thu Mar 31 16:18:22 2016 +0000
+++ b/tests/bin/sh/t_arith.sh   Thu Mar 31 16:19:52 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_arith.sh,v 1.2 2016/03/16 17:39:12 christos Exp $
+# $NetBSD: t_arith.sh,v 1.3 2016/03/31 16:19:52 christos Exp $
 #
 # Copyright (c) 2016 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -280,9 +280,9 @@
        atf_check -s exit:0 -o inline:'5555\n' -e empty ${TEST_SH} -c \
                'echo $((+3333+2222))'
        atf_check -s exit:0 -o inline:'7777\n' -e empty ${TEST_SH} -c \
-               'echo $((+3333++4444))'
+               'echo $((+3333 + +4444))'
        atf_check -s exit:0 -o inline:'-7777\n' -e empty ${TEST_SH} -c \
-               'echo -$((+4125++3652))'
+               'echo -$((+4125+ +3652))'
 }
 
 atf_test_case elementary_sub
@@ -311,7 +311,7 @@
        atf_check -s exit:0 -o inline:'-7694\n' -e empty ${TEST_SH} -c \
                'echo $(( -2016-5678 ))'
        atf_check -s exit:0 -o inline:'--1\n' -e empty ${TEST_SH} -c \
-               'echo -$(( -1018--1017 ))'
+               'echo -$(( -1018 - -1017 ))'
 }
 
 atf_test_case elementary_mul



Home | Main Index | Thread Index | Old Index