Allow set -u in test scripts#24
Conversation
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.
|
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. |
|
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 |
|
@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 thank you for your work! Sure, add me to the list! |
|
Done! Thanks again for your motivation/contribution! I just cut a v2.0.4 release with this code in it. |
If test scripts (or scripts included from them) set the flag -u to treat unset variables as an error when substituting,
tswas failing when accessing$1, which causes not to run any test at all.