Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS zsh: sourcing ./shunit2 throws an error: _shunit_fatal:1: command not found: echo -e #147

Open
alexbigkid opened this issue Sep 3, 2021 · 3 comments
Labels

Comments

@alexbigkid
Copy link

Hi Kate,

Just discovered your GIT repo. Great work! Until now I always tested shell scripts manually.
Trying to write few tests with your unit test framework.

Having a problem to run it on zsh shell though. I traced it down to ./shunit2 line 40-44.
when sourcing the the lib with ". ./shunit2" it throws an error: _shunit_fatal:1: command not found: echo -e

I am running on macOS BigSur 11.5.2, zsh version 5.8. Here are the details:
$ uname -mprsv
Darwin 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64 i386

shell name: zsh
shell version: 5.8

--- Executing the 'sbxCommon' test suite ---
_shunit_fatal:1: command not found: echo -e

the bash and sh is running fine though

@kward
Copy link
Owner

kward commented Oct 23, 2021

Can you provide some sample code that demonstrates the problem? Feel free to only share enough to demonstrate the issue.

Also, shUnit2 is tested using 'set -u' and 'set -e'. Are there other options set in your environment?

@kward
Copy link
Owner

kward commented Oct 23, 2021

To note, this is what I get when running a quick test on my local machine running macOS Monterey 12.0.1.

[kward@kward-macpro13 2021-10-23T18:08:44 %1]~/var/wa/github.com/kward/shunit2
$ uname -a
Darwin kward-macpro13.ka.corp.forestent.com 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:23 PDT 2021; root:xnu-8019.41.5~1/RELEASE_X86_64 x86_64
[kward@kward-macpro13 2021-10-23T18:08:47 %1]~/var/wa/github.com/kward/shunit2
$ zsh
kward@kward-macpro13 shunit2 % ./shunit2

Ran 0 tests.

OK
kward@kward-macpro13 shunit2 % zsh --version
zsh 5.8 (x86_64-apple-darwin21.0)

Obviously this isn't testing your setup…

@kward kward added the bug label Oct 23, 2021
@JussiPekonen
Copy link

Actually, this is the issue that can be fixed by setting the shwordsplit option for zsh, see here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants