I agree: this is great as an intellectual exercise but I’m reminded about how many times I’ve been glad that I set a policy in the 2000s that any bash script too large for a normal size screen should be rewritten in Python.
Re:Bash_unit – bash unit testing framework
by fooflarney on Tuesday March 02, 2021 @11:00AM
(#26316658)
or just make
Re:Bash_unit – bash unit testing framework
by CraigJPerry on Tuesday March 02, 2021 @02:00PM
(#26318982)
GNU make? BSD make? (Trick question - which BSD make?) nmake? (Another trick question...) - and that’s just Linux, MacOS and Windows today. Admittedly it was even worse previously.
There’s so many flavours of make with annoyingly incompatible syntax and that’s before you get into the presence of GMSL or equiv on each platform.
There’s only one fitting answer to this and it’s the output of the following command:
make love
Except depending on your make, this joke doesn’t work :-(
However, having been down this path myself, i don’t think it’s a great idea.
Beyond the hello world examples you start to run into the need to defang commands being tested or getting better visibility of what they’re doing just so you can make a useful assert, you end up LD_PRELOAD’ing shims to intercept calls and it gets a bit horrifying, very quickly.