Permalink
Please sign in to comment.
Browse files
Fix precedence of chains of && and ||.
In command mode, they have EQUAL precedence, unlike inside [[. This bug is tickled by Aboriginal Linux. - Add a gold test and spec test. - Reorganize test/gold.sh a little.
- Loading branch information...
Showing
with
122 additions
and 66 deletions.
- +32 −15 core/cmd_exec.py
- +27 −0 gold/and-or.sh
- +25 −20 osh/cmd_parse.py
- +1 −2 osh/osh.asdl
- +17 −0 spec/smoke.test.sh
- +19 −28 test/gold.sh
- +1 −1 test/spec.sh
| @@ -0,0 +1,27 @@ | ||
| #!/bin/bash | ||
| # | ||
| # Test chained and/or. | ||
| # From Aboriginal sources/download_functions.sh. | ||
| noversion() | ||
| { | ||
| LOGRUS='s/-*\(\([0-9\.]\)*\([_-]rc\)*\(-pre\)*\([0-9][a-zA-Z]\)*\)*\(\.tar\(\..z2*\)*\)$' | ||
| [ -z "$2" ] && LOGRUS="$LOGRUS//" || LOGRUS="$LOGRUS/$2\\6/" | ||
| echo "$1" | sed -e "$LOGRUS" | ||
| } | ||
| # Simplified version. | ||
| simple() { | ||
| [ -z "$1" ] && LOGRUS="yes" || LOGRUS="no" | ||
| } | ||
| test-simple() { | ||
| simple 1 | ||
| echo $LOGRUS | ||
| simple '' | ||
| echo $LOGRUS | ||
| } | ||
| "$@" |
0 comments on commit
100d2e6