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 12
12
- tear_down
13
13
- set_up_before_script
14
14
- tear_down_after_script
15
+ - Fix false negative from ` assert_have_been_called_with ` with pipes
15
16
16
17
## [ 0.24.0] ( https://github.com/TypedDevs/bashunit/compare/0.23.0...0.24.0 ) - 2025-09-14
17
18
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ function spy() {
59
59
serialized+=\"\$ (printf '%q' \"\$ arg\" )$'\\ x1f'\"
60
60
done
61
61
serialized=\$ {serialized%$'\\ x1f'}
62
- printf '%s| %s\\ n' \"\$ raw\" \"\$ serialized\" >> '$params_file '
62
+ printf '%s\x1e %s\\ n' \"\$ raw\" \"\$ serialized\" >> '$params_file '
63
63
local _c=\$ (cat '$times_file ')
64
64
_c=\$ ((_c+1))
65
65
echo \"\$ _c\" > '$times_file '
@@ -115,7 +115,7 @@ function assert_have_been_called_with() {
115
115
fi
116
116
117
117
local raw
118
- IFS=' | ' read -r raw _ <<< " $line"
118
+ IFS=$' \x1e ' read -r raw _ <<< " $line"
119
119
120
120
if [[ " $expected " != " $raw " ]]; then
121
121
state::add_assertions_failed
Original file line number Diff line number Diff line change @@ -166,3 +166,11 @@ function test_spy_unsuccessful_not_called() {
166
166
" actual" " 1 times" ) " \
167
167
" $( assert_not_called ps) "
168
168
}
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