Permalink
Browse files
Fix spec tests and adjust allowed failures.
- Fix a bug in arithmetic parse error
- Disallow redirects in assignments
- Adjust for 'A= (1 2)' being fixed
- Add a failing test for 'echo a(b)' in osh
Loading branch information...
Showing
5 changed files
with
23 additions
and
12 deletions .
+4
−1
osh/arith_parse.py
+0
−2
spec/arith.test.sh
+5
−0
spec/parse-errors.test.sh
+13
−8
spec/redirect.test.sh
+1
−1
test/spec.sh
@@ -6,10 +6,13 @@
import sys
from core import tdop
from core import util
from core.id_kind import Id
from core import word
from osh import ast_ as ast
p_die = util.p_die
def NullIncDec (p , w , bp ):
""" ++x or ++x[1] """
@@ -64,7 +67,7 @@ def LeftIndex(p, w, left, unused_bp):
3. strings don't have mutable characters.
"""
if not tdop.IsIndexable(left):
raise tdop.TdopParseError (" %s can't be indexed" % left)
p_die (" %s can't be indexed" , left, word = w )
index = p.ParseUntil(0 )
p.Eat(Id.Arith_RBracket)
@@ -323,5 +323,3 @@ echo "status=$?"
# N-I dash stdout: status=127
# N-I dash status: 0
@@ -98,3 +98,8 @@ f() {
}
# status: 2
# BUG dash/bash/mksh status: 0
# ## misplaced parentheses are not a subshell
echo a(b)
# status: 2
# OK mksh status: 1
@@ -23,18 +23,20 @@ echo status=$?
# stdout: status=1
# OK dash stdout: status=2
# ## No command
# Hm this is valid in bash and dash. It's parsed as an assigment with a
# redirect, which doesn't make sense. But it's a mistake, and should be a W2
# warning for us.
FOO=bar 2> /dev/null
# ## Redirect in subshell
# ## Redirect in command sub
FOO=$( echo foo 1>&2 )
echo $FOO
# stdout:
# stderr: foo
# ## Redirect in assignment is invalid
# Hm this is valid in bash and dash. It's parsed as an assigment with a
# redirect, which doesn't make sense. But it's a mistake, and should be a W2
# warning for us.
FOO=bar 2> /dev/null
# status: 2
# OK bash/dash/mksh status: 0
# ## Redirect in assignment
# dash captures stderr to a file here, which seems correct. Bash doesn't and
# just lets it go to actual stderr.
@@ -44,8 +46,11 @@ FOO=$(echo foo 1>&2) 2>$TMP/no-command.txt
echo FILE=
cat $TMP /no-command.txt
echo " FOO=$FOO "
# stdout-json: "FILE=\nfoo\nFOO=\n"
# status: 2
# OK dash/mksh stdout-json: "FILE=\nfoo\nFOO=\n"
# OK dash/mksh status: 0
# BUG bash stdout-json: "FILE=\nFOO=\n"
# OK bash status: 0
# ## Redirect in function body.
func () { echo hi; } 1>&2
@@ -416,7 +416,7 @@ arith-context() {
}
array () {
sh-spec spec/array.test.sh --osh-failures-allowed 12 \
sh-spec spec/array.test.sh --osh-failures-allowed 11 \
$BASH $MKSH $OSH " $@ "
}
Toggle all file notes
0 comments on commit
c19885e