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 support in Snap.Snaplet.Test for reusing initializers. #105

Merged
merged 3 commits into from
Apr 5, 2014

Conversation

dbp
Copy link
Contributor

@dbp dbp commented Mar 4, 2014

This allows for much more efficient testing libraries, as initializing can take a while, and if you want to run many tests, currently you have to pay that startup time for each runHandler/evalHandler.

The only question I had was whether to wrap InitializerState inside an opaque type (so it could only be used with the functions in this module). I didn't, but can make that change if it is preferred.

- expose getSnaplet helper that returns a Snaplet and InitializerState
  and expose the InitializerState type
- add closeSnaplet to run cleanup, to be used after all tests have been run.
- add evalHandler' and runHandler' that take Snaplet and
  InitializerState and otherwise parallel evalHandler and runHandler

------------------------------------------------------------------------------
-- | Helper to allow multiple calls to "runHandler" or "evalHandler" without
-- multiple initializations
Copy link
Member

Choose a reason for hiding this comment

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

Quibble: add a period at the end of the docstring sentence

@gregorycollins
Copy link
Member

Could you please add tests for the new methods to the testsuite?

@dbp
Copy link
Contributor Author

dbp commented Mar 4, 2014

@gregorycollins Just to check, there aren't any existing tests for Snap.Snaplet.Test, right? I poked around, but don't want to add a new file if there is an existing place to put them.

@gregorycollins
Copy link
Member

We should be using this module to test the other modules. The important thing is to check the test coverage report and ensure the functions are covered, it doesn't matter too much where the tests go.

@mightybyte
Copy link
Member

The snap test suite is a little bit scattered because most of it was written before we had the Snaplet.Test module. So feel free to use these functions to replace any of our other tests if there are good places to do that.

@dbp
Copy link
Contributor Author

dbp commented Mar 5, 2014

I've added tests for the new functions and the old ones (the old ones were getting coverage via usage for Auth tests, but I thought it made sense to put in basic tests for them as well). The tests are pretty basic, but the functions aren't doing a whole lot, either.

mightybyte added a commit that referenced this pull request Apr 5, 2014
Add support in Snap.Snaplet.Test for reusing initializers.
@mightybyte mightybyte merged commit 0de9d2d into snapframework:master Apr 5, 2014
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