Fork me on GitHub
#testing
<
2020-05-19
>
NoahTheDuke16:05:03

@srijayanth i've been thinking about this recently. i develop a game that uses an atom as the "game state", and have a test macro called do-game that takes a state created with a (new-game ...) function, and then binds it in a let block with a consistent name (`state`), binds a bunch of helpful functions so you don't have to type state in everywhere, and then [email protected] all of the enclosed test expressions, so the set up is taken care of easily

NoahTheDuke16:05:09

this gets awkward when i have to set up the same "initial state" for multiple tests, so i've been experimenting with another anaphoric macro that lets me do a before binding and insert a single state into each (testing) wrapper in my deftest

NoahTheDuke16:05:03

i don't think this is very idiomatic, because of the focus on non-mutating functions, but sadly my game engine is full of mutation lol