Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test harness using ts #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add test harness using ts #3

wants to merge 1 commit into from

Conversation

thinkerbot
Copy link

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

  • I wrote ts and naturally I like it but no worries if this is not your style. Seriously I will not be offended.
  • This covers pretty much all that ts provides. You get a function to assert_status and another one to assert_output, you get a $ts_test_dir variable that you can make into a dir and to store test-specific files, you get a setup and a teardown function. Not much else. Each test is run in a subshell to prevent carryover. You have to orchestrate the rest to your liking.
  • To get ts, clone the repo and add the bin dir to PATH. You might just want to vendor it, it's just one file.

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.
@stormmq
Copy link

stormmq commented Jan 20, 2015

Simon

Looks interesting. Im travelling now until Thu - will get back in touch
then.
On 20 Jan 2015 16:12, "Simon Chiang" [email protected] wrote:

ts https://github.com/thinkerbot/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

I wrote ts and naturally I like it but no worries if this is not your
style. Seriously I will not be offended.

This covers pretty much all that ts provides. You get a function to
assert_status and another one to assert_output, you get a $ts_test_dir
variable that you can make into a dir and to store test-specific files, you
get a setup and a teardown function. Not much else. Each test is run
in a subshell to prevent carryover. You have to orchestrate the rest to
your liking.

To get ts, clone the repo and add the bin dir to PATH. You might just
want to vendor it, it's just one file.


You can view, comment on, or merge this pull request online at:

#3
Commit Summary

  • Add test harness using ts

File Changes

Patch Links:


Reply to this email directly or view it on GitHub
#3.

@@ -0,0 +1,19 @@
#!/bin/bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use #!/usr/bin/env sh for shellfire scripts so that we don't force a particular shell on folks.

@raphaelcohn
Copy link
Member

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).

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.

3 participants