1
0
mirror of https://github.com/sstephenson/bats.git synced 2024-09-30 04:58:36 +02:00
Commit Graph

7 Commits

Author SHA1 Message Date
Mike Bland
8c4a86d534
format-tap: Refactor summary to remove subshells
While the performance impact of these changes are in the noise under
macOS 10.12.3 on a on a MacBook Pro with a 2.9GHz Intel Core i5 CPU and
8GB 1867MHz DDR3 RAM, eliminating these subshells makes the code more
consistent.

I did try removing `buffer` to eliminate yet more subshells, but the
flickering of the output did prove annoying, so I'm not removing it.
2017-09-30 15:12:38 -04:00
Henrique Moody
3be82466a7 Add skipped count tests in the summary
This also update the behaviour of the summary, now it only display the
number of failures, and skipped tests also, if the numbers are greater
than zero.
2014-08-13 14:32:35 +01:00
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
25505bd143 Skip pretty formatting if the first line isn't a TAP plan
Closes #21
2013-10-28 14:47:52 -05:00
Sam Stephenson
d2c5b9ef71 Remove defunct comment-pad trimming 2013-10-28 14:47:52 -05:00
Sam Stephenson
1534201101 Emit ANSI escape sequences directly instead of calling tput 2013-10-28 12:21:16 -05:00
Sam Stephenson
a3229efbfa Pretty test output for terminals 2013-10-21 12:03:45 -05:00