Skip to content

Commit 6965c71

Browse files
author
Pascal Grange
committed
prepare release v2.0.0
1 parent 9628fdb commit 6965c71

File tree

2 files changed

+40
-13
lines changed

2 files changed

+40
-13
lines changed

bash_unit

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#
1717
# https://github.com/pgrange/bash_unit
1818

19-
VERSION=v1.9.1
19+
VERSION=v2.0.0
2020

2121
ESCAPE=$(printf "\033")
2222
NOCOLOR="${ESCAPE}[0m"

docs/man/man1/bash_unit.1

+39-12
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
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
114115
Overall result: SUCCESS
115116
.fam
@@ -199,6 +200,7 @@ ok \- test_fake_can_fake_inline
199200
ok \- test_fake_echo_stdin_when_no_params
200201
ok \- test_fake_exports_faked_in_subshells
201202
ok \- test_fake_transmits_params_to_fake_code
203+
ok \- test_fake_transmits_params_to_fake_code_as_array
202204
ok \- 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(CRexpected\-file\fP matches the content of \f(CRactual\-file\fP.
617+
Asserts that the content of the file \fIactual\fP does not have any differences to the one \fIexpected\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 \*(AqREADME.adoc\*(Aq should be the same as \*(Aqbash_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 \*(AqREADME.adoc\*(Aq should be the same as \*(Aqbash_unit\*(Aq
638+
expected \*(AqREADME.adoc\*(Aq to be identical to \*(Aqbash_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 "\fBFAKE\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 \fIstdin\fP to test that code fails when some process does not run and succeeds otherwise:
698+
Here is an example, parameterizing fake with its \fIstdin\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
820847
For instance, in our previous code that checks apache is running, we have an issue since our code does not use \fIps\fP with the appropriate parameters. So we will try to check that parameters given to ps are \fIax\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() {
836863
24162 pts/7 00:00:00 ps
837864
8387 ? 0:00 /usr/sbin/apache2 \-k start
838865
EOF
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

883910
test_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

921948
test_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

964991
test_code_gives_ps_appropriate_parameters() {
965-
fake ps \*(Aqecho $FAKE_PARAMS >/tmp/fake_params\*(Aq
992+
fake ps \*(Aqecho ${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 \*(Aqecho $FAKE_PARAMS >&$test_channel\*(Aq
1029+
fake ps \*(Aqecho ${FAKE_PARAMS[@]} >&$test_channel\*(Aq
10031030

10041031
code || true
10051032

0 commit comments

Comments
 (0)