Permalink
Please sign in to comment.
Browse files
Test the consistency of shells with regard to parsing empty bodies.
Brought up by Yorwba. OSH seems to be the most consistent.
- Loading branch information...
Showing
with
30 additions
and 0 deletions.
- +25 −0 spec/empty-bodies.test.sh
- +1 −0 spec/for-expr.test.sh
- +4 −0 test/spec.sh
| @@ -0,0 +1,25 @@ | ||
| #!/usr/bin/env bash | ||
| ### Empty do/done | ||
| while false; do | ||
| done | ||
| echo empty | ||
| # stdout: empty | ||
| # OK dash/bash stdout-json: "" | ||
| # OK dash/bash status: 2 | ||
| ### Empty case/esac | ||
| case foo in | ||
| esac | ||
| echo empty | ||
| # stdout: empty | ||
| ### empty then/fi | ||
| if foo; then | ||
| fi | ||
| echo empty | ||
| # stdout: empty | ||
| # OK dash/bash stdout-json: "" | ||
| # OK dash/bash status: 2 | ||
| # OK mksh stdout-json: "" | ||
| # OK mksh status: 1 |
0 comments on commit
3315b78