11'\" t
22.\" Title: bash_unit
33.\" Author: [see the "AUTHOR(S)" section]
4- .\" Generator: Asciidoctor 2.0.16
5- .\" Date: 2022-01-05
4+ .\" Generator: Asciidoctor 2.0.17
5+ .\" Date: 2022-06-17
66.\" Manual: \ \&
77.\" Source: \ \&
88.\" Language: English
99.\"
10- .TH "BASH_UNIT" "1" "2022-01-05 " "\ \& " "\ \& "
10+ .TH "BASH_UNIT" "1" "2022-06-17 " "\ \& " "\ \& "
1111.ie \n( .g .ds Aq \(aq
1212.el .ds Aq '
1313.ss \n[ .ss ] 0
@@ -110,6 +110,7 @@ Running tests in tests/test_core.sh
110110 Running test_fake_echo_stdin_when_no_params ... SUCCESS
111111 Running test_fake_exports_faked_in_subshells ... SUCCESS
112112 Running test_fake_transmits_params_to_fake_code ... SUCCESS
113+ Running test_fake_transmits_params_to_fake_code_as_array ... SUCCESS
113114 Running test_should_pretty_format_even_when_LANG_is_unset ... SUCCESS
114115Overall result: SUCCESS
115116.fam
@@ -199,6 +200,7 @@ ok \- test_fake_can_fake_inline
199200ok \- test_fake_echo_stdin_when_no_params
200201ok \- test_fake_exports_faked_in_subshells
201202ok \- test_fake_transmits_params_to_fake_code
203+ ok \- test_fake_transmits_params_to_fake_code_as_array
202204ok \- test_should_pretty_format_even_when_LANG_is_unset
203205.fam
204206.fi
@@ -607,12 +609,37 @@ doc:2:test_obvious_matching_with_assert_not_matches()
607609.if n .RS 4
608610.nf
609611.fam C
610- assert_no_diff <expected\- file > <actual\- file > [message]
612+ assert_no_diff <expected> <actual> [message]
611613.fam
612614.fi
613615.if n .RE
614616.sp
615- Asserts that the content of \f(CR expected \- file \fP matches the content of \f(CR actual \- file \fP .
617+ Asserts that the content of the file \fI actual \fP does not have any differences to the one \fI expected \fP .
618+ .sp
619+ .if n .RS 4
620+ .nf
621+ .fam C
622+ test_obvious_notmatching_with_assert_no_diff(){
623+ assert_no_diff bash_unit README.adoc "content of \*( Aq README.adoc\*( Aq should be the same as \*( Aq bash_unit\*( Aq "
624+ }
625+ test_obvious_matching_with_assert_assert_no_diff(){
626+ assert_no_diff bash_unit bash_unit
627+ }
628+ .fam
629+ .fi
630+ .if n .RE
631+ .sp
632+ .if n .RS 4
633+ .nf
634+ .fam C
635+ Running test_obvious_matching_with_assert_assert_no_diff ... SUCCESS
636+ Running test_obvious_notmatching_with_assert_no_diff ... FAILURE
637+ content of \*( Aq README.adoc\*( Aq should be the same as \*( Aq bash_unit\*( Aq
638+ expected \*( Aq README.adoc\*( Aq to be identical to \*( Aq bash_unit\*( Aq but was different
639+ doc:2:test_obvious_notmatching_with_assert_no_diff()
640+ .fam
641+ .fi
642+ .if n .RE
616643.SH "\fB FAKE \fP FUNCTION"
617644.sp
618645.if n .RS 4
@@ -668,7 +695,7 @@ hello world
668695.if n .RE
669696.SS "Using stdin"
670697.sp
671- Here is an exemple , parameterizing fake with its \fI stdin \fP to test that code fails when some process does not run and succeeds otherwise:
698+ Here is an example , parameterizing fake with its \fI stdin \fP to test that code fails when some process does not run and succeeds otherwise:
672699.sp
673700.if n .RS 4
674701.nf
@@ -819,7 +846,7 @@ It can also help in asserting the values of these parameters ... but this may be
819846.sp
820847For instance, in our previous code that checks apache is running, we have an issue since our code does not use \fI ps \fP with the appropriate parameters. So we will try to check that parameters given to ps are \fI ax \fP .
821848.sp
822- To do that, the first naive approch would be:
849+ To do that, the first naive approach would be:
823850.sp
824851.if n .RS 4
825852.nf
@@ -836,7 +863,7 @@ test_code_gives_ps_appropriate_parameters() {
83686324162 pts/7 00:00:00 ps
837864 8387 ? 0:00 /usr/sbin/apache2 \- k start
838865EOF
839- assert_equals ax "$FAKE_PARAMS"
866+ assert_equals ax "${ FAKE_PARAMS[@]} "
840867 }
841868 export \- f _ps
842869 fake ps _ps
@@ -882,7 +909,7 @@ code() {
882909
883910test_code_gives_ps_appropriate_parameters() {
884911 _ps() {
885- assert_equals ax "$FAKE_PARAMS"
912+ assert_equals ax "${ FAKE_PARAMS[@]} "
886913 }
887914 export \- f _ps
888915 fake ps _ps
@@ -920,7 +947,7 @@ code() {
920947
921948test_code_gives_ps_appropriate_parameters() {
922949 _ps() {
923- echo $FAKE_PARAMS > /tmp/fake_params
950+ echo ${ FAKE_PARAMS[@]} > /tmp/fake_params
924951 }
925952 export \- f _ps
926953 fake ps _ps
@@ -962,7 +989,7 @@ code() {
962989}
963990
964991test_code_gives_ps_appropriate_parameters() {
965- fake ps \*( Aq echo $FAKE_PARAMS >/tmp/fake_params\*( Aq
992+ fake ps \*( Aq echo ${ FAKE_PARAMS[@]} >/tmp/fake_params\*( Aq
966993
967994 code || true
968995
@@ -999,7 +1026,7 @@ test_get_data_from_fake() {
9991026 #Fasten you seat belt ...
10001027 coproc cat
10011028 exec {test_channel}>&${COPROC[1]}
1002- fake ps \*( Aq echo $FAKE_PARAMS >&$test_channel\*( Aq
1029+ fake ps \*( Aq echo ${ FAKE_PARAMS[@]} >&$test_channel\*( Aq
10031030
10041031 code || true
10051032
0 commit comments