|
2 | 2 | .\" Title: bash_unit
|
3 | 3 | .\" Author: [see the "AUTHORS" section]
|
4 | 4 | .\" Generator: Asciidoctor 1.5.5
|
5 |
| -.\" Date: 2017-07-07 |
| 5 | +.\" Date: 2017-09-01 |
6 | 6 | .\" Manual: \ \&
|
7 | 7 | .\" Source: \ \&
|
8 | 8 | .\" Language: English
|
9 | 9 | .\"
|
10 |
| -.TH "BASH_UNIT" "1" "2017-07-07" "\ \&" "\ \&" |
| 10 | +.TH "BASH_UNIT" "1" "2017-09-01" "\ \&" "\ \&" |
11 | 11 | .ie \n(.g .ds Aq \(aq
|
12 | 12 | .el .ds Aq '
|
13 | 13 | .ss \n[.ss] 0
|
@@ -72,9 +72,9 @@ To run tests, simply call \fBbash_unit\fP with all your tests files as parameter
|
72 | 72 | Running tests in tests/test_core.sh
|
73 | 73 | Running test_assert_equals_fails_when_not_equal... SUCCESS
|
74 | 74 | Running test_assert_equals_succeed_when_equal... SUCCESS
|
75 |
| -Running test_assert_fail_fails... SUCCESS |
76 |
| -Running test_assert_fail_succeeds... SUCCESS |
77 | 75 | Running test_assert_fails... SUCCESS
|
| 76 | +Running test_assert_fails_fails... SUCCESS |
| 77 | +Running test_assert_fails_succeeds... SUCCESS |
78 | 78 | Running test_assert_not_equals_fails_when_equal... SUCCESS
|
79 | 79 | Running test_assert_not_equals_succeeds_when_not_equal... SUCCESS
|
80 | 80 | Running test_assert_shows_stderr_on_failure... SUCCESS
|
@@ -116,9 +116,9 @@ functions against this pattern.
|
116 | 116 | Running tests in tests/test_core.sh
|
117 | 117 | Running test_assert_equals_fails_when_not_equal... SUCCESS
|
118 | 118 | Running test_assert_equals_succeed_when_equal... SUCCESS
|
119 |
| -Running test_assert_fail_fails... SUCCESS |
120 |
| -Running test_assert_fail_succeeds... SUCCESS |
121 | 119 | Running test_assert_fails... SUCCESS
|
| 120 | +Running test_assert_fails_fails... SUCCESS |
| 121 | +Running test_assert_fails_succeeds... SUCCESS |
122 | 122 | Running test_assert_not_equals_fails_when_equal... SUCCESS
|
123 | 123 | Running test_assert_not_equals_succeeds_when_not_equal... SUCCESS
|
124 | 124 | Running test_assert_shows_stderr_on_failure... SUCCESS
|
@@ -154,9 +154,9 @@ output with the \fI\-f\fP option.
|
154 | 154 | # Running tests in tests/test_core.sh
|
155 | 155 | ok \- test_assert_equals_fails_when_not_equal
|
156 | 156 | ok \- test_assert_equals_succeed_when_equal
|
157 |
| -ok \- test_assert_fail_fails |
158 |
| -ok \- test_assert_fail_succeeds |
159 | 157 | ok \- test_assert_fails
|
| 158 | +ok \- test_assert_fails_fails |
| 159 | +ok \- test_assert_fails_succeeds |
160 | 160 | ok \- test_assert_not_equals_fails_when_equal
|
161 | 161 | ok \- test_assert_not_equals_succeeds_when_not_equal
|
162 | 162 | ok \- test_assert_shows_stderr_on_failure
|
@@ -186,7 +186,13 @@ You may write a \fBsetup\fP function that will be exectuted before each test is
|
186 | 186 | .sp
|
187 | 187 | You may write a \fBteardown\fP function that will be exectuted after each test is run.
|
188 | 188 | .sp
|
189 |
| -If you need to set someting up only once for all tests, simply write your code outside any test function, this is a bash script. |
| 189 | +You may write a \fBsetup_suite\fP function that will be executed only once before all the tests of your test file. |
| 190 | +.sp |
| 191 | +You may write a \fBteardown_suite\fP function that will be executed only once after all the tests of your test file. |
| 192 | +.sp |
| 193 | +If you write code outside of any bash function, this code will be executed once at test file loading time since |
| 194 | +your file is a bash script and \fBbash_unit\fP sources it before running your tests. It is suggested to write a |
| 195 | +\fBsetup_suite\fP function and avoid any code outside a bash function. |
190 | 196 | .sp
|
191 | 197 | If you want to keep an eye on a test not yet implemented, prefix the name of the function by \fBtodo\fP instead of test.
|
192 | 198 | Test to do are not executed and do not impact the global status of your test suite but are displayed in \fBbash_unit\fP output.
|
@@ -382,13 +388,13 @@ code() {
|
382 | 388 | test_code_does_not_write_cool_in_the_file() {
|
383 | 389 | code
|
384 | 390 |
|
385 |
| - assert_fail "grep cool /tmp/the_file" "should not write \(aqcool\(aq in /tmp/the_file" |
| 391 | + assert_fails "grep cool /tmp/the_file" "should not write \(aqcool\(aq in /tmp/the_file" |
386 | 392 | }
|
387 | 393 |
|
388 | 394 | test_code_does_not_write_this_in_the_file() {
|
389 | 395 | code
|
390 | 396 |
|
391 |
| - assert_fail "grep this /tmp/the_file" "should not write \(aqthis\(aq in /tmp/the_file" |
| 397 | + assert_fails "grep this /tmp/the_file" "should not write \(aqthis\(aq in /tmp/the_file" |
392 | 398 | }
|
393 | 399 | .fi
|
394 | 400 | .if n \{\
|
@@ -630,7 +636,7 @@ test_code_fails_if_apache_does_not_run() {
|
630 | 636 | 24162 pts/7 00:00:00 ps
|
631 | 637 | EOF
|
632 | 638 |
|
633 |
| - assert_fail code "code should fail when apache is not running" |
| 639 | + assert_fails code "code should fail when apache is not running" |
634 | 640 | }
|
635 | 641 | .fi
|
636 | 642 | .if n \{\
|
|
0 commit comments