Permalink
Browse files

Fix spec tests after the fix for [ -a ].

Now that we allow -a as a prefix operator, OSH behaves more like other
shells.

Also add missing error check when parsing boolean expressions.  This
fixes a crash in [ exposed in blog2.test.sh.
  • Loading branch information...
Andy Chu
Andy Chu committed Nov 16, 2017
1 parent 6ea7878 commit 5a37cbc55bf8048c64c6e27b0b2aefacdc2ecea3
Showing with 4 additions and 8 deletions.
  1. +2 −0 osh/bool_parse.py
  2. +2 −8 spec/blog2.test.sh
View
@@ -162,6 +162,7 @@ def ParseExpr(self):
if self.op_id in (Id.Op_DPipe, Id.BoolUnary_o):
if not self._Next(): return None
right = self.ParseExpr()
if not right: return None
return ast.LogicalOr(left, right)
else:
return left
@@ -180,6 +181,7 @@ def ParseTerm(self):
if self.op_id in (Id.Op_DAmp, Id.BoolUnary_a):
if not self._Next(): return None
right = self.ParseTerm()
if not right: return None
return ast.LogicalAnd(left, right)
else:
return left
View
@@ -12,7 +12,6 @@ echo status=$?
[ -a -a ]
echo status=$?
# stdout: status=1
# N-I osh stdout: status=2
### -a -a -a
[ -a -a -a ]
@@ -25,32 +24,27 @@ echo status=$?
echo status=$?
# stdout: status=1
# BUG bash stdout: status=2
# N-I osh stdout: status=2
### -a -a -a -a -a
[ -a -a -a -a -a ]
echo status=$?
# stdout: status=1
# BUG dash/zsh stdout: status=0
# N-I osh stdout: status=2
### -a -a -a -a -a -a
[ -a -a -a -a -a -a ]
echo status=$?
# stdout: status=1
# BUG bash/mksh stdout: status=2
# N-I osh stdout: status=2
# stdout: status=2
# BUG dash/zsh stdout: status=1
### -a -a -a -a -a -a -a
[ -a -a -a -a -a -a -a ]
echo status=$?
# stdout: status=1
# BUG bash stdout: status=2
# BUG dash/zsh stdout: status=0
# N-I osh stdout: status=2
### -a -a -a -a -a -a -a -a
[ -a -a -a -a -a -a -a -a ]
echo status=$?
# stdout: status=1
# N-I osh stdout: status=2

0 comments on commit 5a37cbc

Please sign in to comment.