Add test harness using ts#3
Add test harness using ts#3thinkerbot wants to merge 1 commit intoshellfire-dev:masterfrom thinkerbot:ts_test_harness
Conversation
ts is a shell testing library that might serve the needs of shellfire, in some circumstances. This adds a couple examples and a basic test harness.
|
Simon Looks interesting. Im travelling now until Thu - will get back in touch
|
There was a problem hiding this comment.
We use #!/usr/bin/env sh for shellfire scripts so that we don't force a particular shell on folks.
|
It's a good little set of ideas. I think this fits best in shellfire as another module (like core, like build) with a set of functions and a ready-to-use driver (see the build program in the 'build' module). We then link it into the shellfire-dev/shellfire README. Additionally, we might be able to use introspection ('reflection') using declare -F (we'll have to check dash) to find all functions starting, say, _test_NAMESPACE, and just run the lot (_test because 'test' would be the test namespace for things like assert, ie test_assertOutput or, if there's test/assert, test_assert_output). |
ts is a shell testing library that might serve the needs of shellfire, at least for testing leaf functions. This adds a couple examples and a basic test harness.
Notes
tsand naturally I like it but no worries if this is not your style. Seriously I will not be offended.tsprovides. You get a function toassert_statusand another one toassert_output, you get a$ts_test_dirvariable that you can make into a dir and to store test-specific files, you get asetupand ateardownfunction. Not much else. Each test is run in a subshell to prevent carryover. You have to orchestrate the rest to your liking.ts, clone the repo and add thebindir to PATH. You might just want to vendor it, it's just one file.