@@ -88,28 +88,31 @@ To run tests, simply call *bash_unit* with all your tests files as parameter. Fo
8888
8989```output
9090Running tests in tests/test_core.sh
91- Running test_assert_equals_fails_when_not_equal ... SUCCESS
92- Running test_assert_equals_succeed_when_equal ... SUCCESS
93- Running test_assert_fails ... SUCCESS
94- Running test_assert_fails_fails ... SUCCESS
95- Running test_assert_fails_succeeds ... SUCCESS
96- Running test_assert_not_equals_fails_when_equal ... SUCCESS
97- Running test_assert_not_equals_succeeds_when_not_equal ... SUCCESS
98- Running test_assert_shows_stderr_on_failure ... SUCCESS
99- Running test_assert_shows_stdout_on_failure ... SUCCESS
100- Running test_assert_status_code_fails ... SUCCESS
101- Running test_assert_status_code_succeeds ... SUCCESS
102- Running test_assert_succeeds ... SUCCESS
103- Running test_fail_fails ... SUCCESS
104- Running test_fail_prints_failure_message ... SUCCESS
105- Running test_fail_prints_where_is_error ... SUCCESS
106- Running test_fake_actually_fakes_the_command ... SUCCESS
107- Running test_fake_can_fake_inline ... SUCCESS
108- Running test_fake_echo_stdin_when_no_params ... SUCCESS
109- Running test_fake_exports_faked_in_subshells ... SUCCESS
110- Running test_fake_transmits_params_to_fake_code ... SUCCESS
111- Running test_should_pretty_format_even_when_LANG_is_unset ... SUCCESS
112- Overall result: SUCCESS
91+ Running test_assert_equals_fails_when_not_equal ... SUCCESS ✓
92+ Running test_assert_equals_succeed_when_equal ... SUCCESS ✓
93+ Running test_assert_fails ... SUCCESS ✓
94+ Running test_assert_fails_fails ... SUCCESS ✓
95+ Running test_assert_fails_succeeds ... SUCCESS ✓
96+ Running test_assert_no_diff_fails_when_diff ... SUCCESS ✓
97+ Running test_assert_no_diff_succeeds_when_no_diff ... SUCCESS ✓
98+ Running test_assert_not_equals_fails_when_equal ... SUCCESS ✓
99+ Running test_assert_not_equals_succeeds_when_not_equal ... SUCCESS ✓
100+ Running test_assert_shows_stderr_on_failure ... SUCCESS ✓
101+ Running test_assert_shows_stdout_on_failure ... SUCCESS ✓
102+ Running test_assert_status_code_fails ... SUCCESS ✓
103+ Running test_assert_status_code_succeeds ... SUCCESS ✓
104+ Running test_assert_succeeds ... SUCCESS ✓
105+ Running test_bash_unit_changes_cwd_to_current_test_file_directory ... SUCCESS ✓
106+ Running test_fail_fails ... SUCCESS ✓
107+ Running test_fail_prints_failure_message ... SUCCESS ✓
108+ Running test_fail_prints_where_is_error ... SUCCESS ✓
109+ Running test_fake_actually_fakes_the_command ... SUCCESS ✓
110+ Running test_fake_can_fake_inline ... SUCCESS ✓
111+ Running test_fake_echo_stdin_when_no_params ... SUCCESS ✓
112+ Running test_fake_exports_faked_in_subshells ... SUCCESS ✓
113+ Running test_fake_transmits_params_to_fake_code ... SUCCESS ✓
114+ Running test_should_pretty_format_even_when_LANG_is_unset ... SUCCESS ✓
115+ Overall result: SUCCESS ✓
113116```
114117
115118You might also want to run only specific tests, you may do so with the
@@ -122,20 +125,22 @@ functions against this pattern.
122125
123126```output
124127Running tests in tests/test_core.sh
125- Running test_assert_equals_fails_when_not_equal ... SUCCESS
126- Running test_assert_equals_succeed_when_equal ... SUCCESS
127- Running test_assert_fails ... SUCCESS
128- Running test_assert_fails_fails ... SUCCESS
129- Running test_assert_fails_succeeds ... SUCCESS
130- Running test_assert_not_equals_fails_when_equal ... SUCCESS
131- Running test_assert_not_equals_succeeds_when_not_equal ... SUCCESS
132- Running test_assert_shows_stderr_on_failure ... SUCCESS
133- Running test_assert_shows_stdout_on_failure ... SUCCESS
134- Running test_assert_status_code_fails ... SUCCESS
135- Running test_assert_status_code_succeeds ... SUCCESS
136- Running test_assert_succeeds ... SUCCESS
137- Running test_fail_fails ... SUCCESS
138- Overall result: SUCCESS
128+ Running test_assert_equals_fails_when_not_equal ... SUCCESS ✓
129+ Running test_assert_equals_succeed_when_equal ... SUCCESS ✓
130+ Running test_assert_fails ... SUCCESS ✓
131+ Running test_assert_fails_fails ... SUCCESS ✓
132+ Running test_assert_fails_succeeds ... SUCCESS ✓
133+ Running test_assert_no_diff_fails_when_diff ... SUCCESS ✓
134+ Running test_assert_no_diff_succeeds_when_no_diff ... SUCCESS ✓
135+ Running test_assert_not_equals_fails_when_equal ... SUCCESS ✓
136+ Running test_assert_not_equals_succeeds_when_not_equal ... SUCCESS ✓
137+ Running test_assert_shows_stderr_on_failure ... SUCCESS ✓
138+ Running test_assert_shows_stdout_on_failure ... SUCCESS ✓
139+ Running test_assert_status_code_fails ... SUCCESS ✓
140+ Running test_assert_status_code_succeeds ... SUCCESS ✓
141+ Running test_assert_succeeds ... SUCCESS ✓
142+ Running test_fail_fails ... SUCCESS ✓
143+ Overall result: SUCCESS ✓
139144```
140145
141146*bash_unit* supports the http://testanything.org/[Test Anything Protocol] so you can ask for a tap formatted
@@ -147,26 +152,29 @@ output with the _-f_ option.
147152
148153```output
149154# Running tests in tests/test_core.sh
150- ok - test_assert_equals_fails_when_not_equal
151- ok - test_assert_equals_succeed_when_equal
152- ok - test_assert_fails
153- ok - test_assert_fails_fails
154- ok - test_assert_fails_succeeds
155- ok - test_assert_not_equals_fails_when_equal
156- ok - test_assert_not_equals_succeeds_when_not_equal
157- ok - test_assert_shows_stderr_on_failure
158- ok - test_assert_shows_stdout_on_failure
159- ok - test_assert_status_code_fails
160- ok - test_assert_status_code_succeeds
161- ok - test_assert_succeeds
162- ok - test_fail_fails
163- ok - test_fail_prints_failure_message
164- ok - test_fail_prints_where_is_error
165- ok - test_fake_actually_fakes_the_command
166- ok - test_fake_can_fake_inline
167- ok - test_fake_echo_stdin_when_no_params
168- ok - test_fake_exports_faked_in_subshells
169- ok - test_fake_transmits_params_to_fake_code
155+ ok ✓ test_assert_equals_fails_when_not_equal
156+ ok ✓ test_assert_equals_succeed_when_equal
157+ ok ✓ test_assert_fails
158+ ok ✓ test_assert_fails_fails
159+ ok ✓ test_assert_fails_succeeds
160+ ok ✓ test_assert_no_diff_fails_when_diff
161+ ok ✓ test_assert_no_diff_succeeds_when_no_diff
162+ ok ✓ test_assert_not_equals_fails_when_equal
163+ ok ✓ test_assert_not_equals_succeeds_when_not_equal
164+ ok ✓ test_assert_shows_stderr_on_failure
165+ ok ✓ test_assert_shows_stdout_on_failure
166+ ok ✓ test_assert_status_code_fails
167+ ok ✓ test_assert_status_code_succeeds
168+ ok ✓ test_assert_succeeds
169+ ok ✓ test_bash_unit_changes_cwd_to_current_test_file_directory
170+ ok ✓ test_fail_fails
171+ ok ✓ test_fail_prints_failure_message
172+ ok ✓ test_fail_prints_where_is_error
173+ ok ✓ test_fake_actually_fakes_the_command
174+ ok ✓ test_fake_can_fake_inline
175+ ok ✓ test_fake_echo_stdin_when_no_params
176+ ok ✓ test_fake_exports_faked_in_subshells
177+ ok ✓ test_fake_transmits_params_to_fake_code
170178ok - test_should_pretty_format_even_when_LANG_is_unset
171179```
172180
@@ -405,6 +413,29 @@ doc:2:test_obvious_equality_with_assert_not_equals()
405413 Running test_obvious_inequality_with_assert_not_equals ... SUCCESS
406414```
407415
416+ === *assert_no_diff*
417+
418+ assert_no_diff <expected> <actual> [message]
419+
420+ Assert for equality of content between the two files _expected_ and _actual_.
421+
422+ ```test
423+ test_obvious_diff_with_assert_no_diff(){
424+ assert_no_diff <(echo foo) <(echo bar) "dynamic files should have no difference"
425+ }
426+ test_obvious_equality_with_assert_no_diff(){
427+ assert_no_diff "$0" "$0"
428+ }
429+ ```
430+
431+ ```output
432+ Running test_obvious_diff_with_assert_no_diff ... FAILURE ✗
433+ dynamic files should have no difference
434+ expected '/dev/fd/62' to be identical to '/dev/fd/63' but was different
435+ doc:2:test_obvious_diff_with_assert_no_diff()
436+ Running test_obvious_equality_with_assert_no_diff ... SUCCESS ✓
437+ ```
438+
408439== *fake* function
409440
410441 fake <command> [replacement code]
0 commit comments