grain
grain copied to clipboard
[Stdlib] Assertion library
We've gotten far by just using the assert
method in Pervasives for our tests, but I think we could take it to the next level by adding an assert
module to our stdlib.
What are some of your favorite assertion libraries to use as a reference?
All of the rspec
-style assertion libraries have really grown on me. rspec, jest, mocha, the like.
I know @peblair was interested in having some sort of testing support built into the language like Pyret has: https://www.pyret.org/docs/latest/testing.html
But I'd honestly be perfectly happy with some sort of rspec
style framework!
But I guess you're asking a lot more about just assertions and not really a full testing framework. I've liked expect
style libraries, but I'm not sure how well that'd work in Grain.
I'd love to have a full-blown testing framework in the stdlib! I was thinking that might require macros to make a top-tier one, though. What do you think?
I wasn't really thinking about expect
necessarily. Maybe something like https://nodejs.org/api/assert.html or tape's assert (which I think was just a wrapper around node's assert).
I was trying to avoid dropping the M-word on this thread, but yeah I agree 🙂
Yeah, we could totally get a basic version of Node's assert done pretty quick. I suppose ours would be a lot smaller.
Yep! I was really just hoping for an inverted operator so we don't have to do assert !Something
because I really don't like how that reads 🤣
Dang, it'd be really nice to have optional arguments here for messages.
Oooooh, yeah 💯