1
0
mirror of https://github.com/sstephenson/bats.git synced 2024-11-17 19:52:37 +01:00
Commit Graph

18 Commits

Author SHA1 Message Date
Andrey Mazo
72c49b88e3 Add run variant with stdout and stderr separated
The code for storing stdout and stderr separately is taken
from answer [1] by TheConstructor [3] to question [2].

[1] http://stackoverflow.com/a/18086548
[2] http://stackoverflow.com/questions/11027679/bash-store-stdout-and-stderr-in-different-variables
[3] http://stackoverflow.com/users/1266906/theconstructor
2014-05-21 00:16:33 -04:00
Sam Stephenson
ddd03ab852 Remove unused variable 2013-11-04 14:00:58 -06:00
Sam Stephenson
c8d63dd7e0 Correctly log errors in setup and teardown functions
Fixes #30
2013-11-04 12:20:55 -06: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
417acfff66 Revert "Revert "Merge pull request #25 from sstephenson/stack-trace""
This reverts commit cb658ba91f.
2013-10-28 20:13:45 -05:00
Sam Stephenson
cb658ba91f Revert "Merge pull request #25 from sstephenson/stack-trace"
This reverts commit 07bdee33a1, reversing
changes made to c36ad10d8c.
2013-10-28 20:10:42 -05:00
Sam Stephenson
de1970fb8f Log the full stack trace when a test fails 2013-10-28 15:10:48 -05:00
Sam Stephenson
8930e4e0d1 Fix for test files without trailing newlines (closes #12) 2013-10-21 12:45:49 -05:00
Sam Stephenson
8873aab79f Extended syntax: "begin" line before each test is run 2013-10-21 11:32:09 -05:00
Sam Stephenson
7849374964 bats_test_info -> bats_test_begin; begin calls setup 2013-10-21 11:21:17 -05:00
Sam Stephenson
a773171777 Don't indent the output of failed tests 2013-10-21 10:58:21 -05:00
Sam Stephenson
c8c56a987c More descriptive message for failing line and file 2013-10-21 10:57:53 -05:00
Ross Duggan
f78324dfec Support for TAP compliant skip directive inside test blocks. 2013-10-18 22:05:20 +01:00
Sam Stephenson
bc72b85871 Print test file path and line number after a failing test 2013-05-23 12:47:17 -05:00
Adam Jacob
af9794634f Using shell redirection rather than cat 2013-05-23 00:52:08 -04:00
Adam Jacob
9c8425d005 Supporting DOS line endings in BATS tests 2013-05-22 21:20:39 -04:00
Sam Stephenson
04be7dc717 Abort when load is invoked with a nonexistent script 2012-11-16 14:35:48 -06:00
Sam Stephenson
f8f78b5cd3 bats-exec -> bats-exec-test 2012-04-09 10:59:36 -05:00