Open
Description
Description
When shunit2 is executed in standalone mode (in Bash shell) and there are failing test cases, there will be a warning message "can only `return' from a function or sourced script" printed out to the shell after the execution.
Steps to reproduce
- Test file
#!/bin/bash
testFailure() {
assertEquals "${SHUNIT_TRUE}" "${SHUNIT_FALSE}"
}
- Use the latest version from the master branch
- Run the test in standalone mode,
./shunit2 <file>
Expected result
The command will exit with a non-zero exit code and the test report contains only details of the tests and where they failed.
Actual result
The report printout contains an unnecessary warning "can only `return' from a function or sourced script" in addition to the test results.
Notes
There is no issue when the test file (given above) sources the shunit2 file. Therefore, this issue affects only the standalone mode.
Metadata
Metadata
Assignees
Labels
No labels