3 ms·
What I've learned from writing a Bash testing framework: Bash is inherently untestable. The only way to reliably return something besides a status code is via
by oweiler 7y ago
What I've learned from writing a Bash testing framework:
Bash is inherently untestable.
The only way to reliably return something besides a status code is via globals.
That means that most functions already rely on previously set global state. Which is one of the reasons that Bash scripts don't scale (the other is non-existent error handling).
Do yourself a favor and use a proper scripting language.
- kohtatsu 7y agoPass-by-global is awful. Make smaller functions that return (echo) a single string. Your bash is untestable, but that's just because of your chosen abstractions. Bash is just a proper script language with a weird string and implicit IO system. Disclaimer: I stick to POSIX sh but same difference.