File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 1212 - tear_down
1313 - set_up_before_script
1414 - tear_down_after_script
15+ - Fix false negative from ` assert_have_been_called_with ` with pipes
1516
1617## [ 0.24.0] ( https://github.com/TypedDevs/bashunit/compare/0.23.0...0.24.0 ) - 2025-09-14
1718
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ function spy() {
5959 serialized+=\"\$ (printf '%q' \"\$ arg\" )$'\\ x1f'\"
6060 done
6161 serialized=\$ {serialized%$'\\ x1f'}
62- printf '%s| %s\\ n' \"\$ raw\" \"\$ serialized\" >> '$params_file '
62+ printf '%s\x1e %s\\ n' \"\$ raw\" \"\$ serialized\" >> '$params_file '
6363 local _c=\$ (cat '$times_file ')
6464 _c=\$ ((_c+1))
6565 echo \"\$ _c\" > '$times_file '
@@ -115,7 +115,7 @@ function assert_have_been_called_with() {
115115 fi
116116
117117 local raw
118- IFS=' | ' read -r raw _ <<< " $line"
118+ IFS=$' \x1e ' read -r raw _ <<< " $line"
119119
120120 if [[ " $expected " != " $raw " ]]; then
121121 state::add_assertions_failed
Original file line number Diff line number Diff line change @@ -166,3 +166,11 @@ function test_spy_unsuccessful_not_called() {
166166 " actual" " 1 times" ) " \
167167 " $( assert_not_called ps) "
168168}
169+
170+ function test_spy_with_pipe_in_arguments() {
171+ spy grep
172+
173+ grep -E ' foo|bar'
174+
175+ assert_have_been_called_with grep ' -E foo|bar'
176+ }
You can’t perform that action at this time.
0 commit comments