-
-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Labels
bugSomething isn't workingSomething isn't working
Description
| Q | A |
|---|---|
| OS | Linux (Cygwin on Windows) |
| Shell & version | bash 5.2.21(1)-release |
| bashunit version | 0.33.0 |
Summary
Spying on or mocking echo or printf causes unit tests to hang
Current behavior
Didn't look until I tried using printf instead of echo but it looks like it's causing bashunit to infinitely spawn processes somewhere.
How to reproduce
function write_data_to_coproc() {
if [ -z "$COPROC" ]; then
return 1
fi
echo >&"${COPROC[0]}" "set_data: $*"
}
function test_write_data_to_coproc() {
COPROC=(12 13)
bashunit::spy echo
write_data_to_coproc "hello world"
assert_have_been_called_with echo "set_data: hello world"
}Probable cause
Unprotected calls to echo/printf instead of using builtin echo/builtin printf
Expected behavior
Unit test completes and bashunit doesn't hang forever.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
No status