1
0
mirror of https://github.com/sstephenson/bats.git synced 2025-03-03 15:29:52 +01:00
Commit Graph

12 Commits

Author SHA1 Message Date
Sam Stephenson
bfa4ebcd0f Prefer let x+=1 for incrementing counters
The `((x++))` syntax is shorthand for `let x++`. According to `help let`:

    If the last ARG evaluates to 0, let returns 1; 0 is returned
    otherwise.

Thus the exit status of the expression `x=0; let x++` is 1, since the post-increment `++` operator evaluates to the value of the variable before incrementing.

In Bash 4, this non-zero exit status properly triggers `set -e`'s error trap, but in Bash 3 it does not. That's why the tests were passing on OS X (Bash 3) but not Linux (Bash 4).

We can work around the problem by choosing an incrementation expression that never evaluates to 0, such as `+=` or the pre-increment `++` operator. For consistency and clarity, I've changed to `x+=1` everywhere.

Ref. #25, #27
2013-10-28 21:01:51 -05:00
Sam Stephenson
2e2477881b Bats 0.3.1 2013-10-28 14:58:32 -05:00
Sam Stephenson
0e5e445728 Bats 0.3.0 2013-10-21 13:14:24 -05:00
Sam Stephenson
a3229efbfa Pretty test output for terminals 2013-10-21 12:03:45 -05:00
Sam Stephenson
672f6e4be2 Invoke bats with multiple files to run an ad-hoc suite 2013-10-18 14:13:00 -05:00
Sam Stephenson
5030f53ecc Bats 0.2.0 2012-11-16 18:06:58 -06:00
Sam Stephenson
19a05cc77d Suite support for aggregating multiple tests under a single run 2012-11-16 14:25:45 -06:00
Sam Stephenson
f8f78b5cd3 bats-exec -> bats-exec-test 2012-04-09 10:59:36 -05:00
Sam Stephenson
6b965e18c4 bats -c filename prints the number of tests in the file 2012-04-08 23:25:38 -05:00
Sam Stephenson
d591867b35 Add -v/--version 2011-12-30 14:12:15 -06:00
Sam Stephenson
b9cfa7470c Initial tests 2011-12-28 16:21:48 -06:00
Sam Stephenson
c850527cce Initial commit 2011-12-28 12:40:14 -06:00