Skip to content

Allow set -u in test scripts#24

Merged
thinkerbot merged 1 commit into
thinkerbot:masterfrom
davidag:allow-set-u-in-tests
May 16, 2020
Merged

Allow set -u in test scripts#24
thinkerbot merged 1 commit into
thinkerbot:masterfrom
davidag:allow-set-u-in-tests

Conversation

@davidag
Copy link
Copy Markdown
Contributor

@davidag davidag commented May 5, 2020

If test scripts (or scripts included from them) set the flag -u to treat unset variables as an error when substituting, ts was failing when accessing $1, which causes not to run any test at all.

If test scripts (or scripts included from them) set the flag -u to treat
unset variables as an error when substituting, `ts` was failing when
accessing $1, which causes not to run any test at all.
@thinkerbot
Copy link
Copy Markdown
Owner

I want to consider this more fully but offhand looks good. I appreciate you looking into this. Relates to #21

@davidag
Copy link
Copy Markdown
Contributor Author

davidag commented May 6, 2020

I want to consider this more fully but offhand looks good. I appreciate you looking into this. Relates to #21

Thanks, @thinkerbot, if there's anything else I can do, just let me know. I guess I can work around this by unsetting the flag, but it'd be better if that wasn't necessary.

@davidag
Copy link
Copy Markdown
Contributor Author

davidag commented May 7, 2020

Let me add some context here. This error arose when I sourced the script under test in a test file. It's not that I'm setting the u flag in my tests scripts. The workaround I've put in place in my project is this: davidag/yadsn@65e1ab2

@thinkerbot
Copy link
Copy Markdown
Owner

@davidag Thanks for your patience - this morning is the first chance I've had to really look at this. It's great! That variable must already be resolving to "" and so explicitly stating that as the default makes every sense. Your test and context are much appreciated. Mind if I add you to the list of contributors?

@thinkerbot thinkerbot merged commit 1d75844 into thinkerbot:master May 16, 2020
@davidag
Copy link
Copy Markdown
Contributor Author

davidag commented May 16, 2020

@thinkerbot thank you for your work! Sure, add me to the list!

@davidag davidag deleted the allow-set-u-in-tests branch May 16, 2020 18:21
@thinkerbot
Copy link
Copy Markdown
Owner

Done! Thanks again for your motivation/contribution! I just cut a v2.0.4 release with this code in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants