To write a Probably test, wrap any expression in a test: test("test name") { <expression> }.check(<predicate on expression>) and that test will be run when the expression is evaluated. You decide when that is. If you can evaluate an expression, you can run a test. Zero magic.
-
-
Show this thread
-
After running the predicate on the expression, the test returns the expression result. The test results are captured in the `test` object. There is an alternative to `check` called `assert` which is the same, but returns unit. Unlike `check` tests, `assert` tests can be skipped.
Show this thread -
When a few tests have run, a report of every test result can be produced and printed in a nice table. Here's the output from Contextual. Tests are given hashes to make them easier to reference. Times are shown automatically. If a test is run multiple times, the count is shown.pic.twitter.com/TzMQkcAMdC
Show this thread -
If you want, you can group tests into a `Suite`, which comes with a `main` method so you can run them as an application and print a report at the end. Here's how Contextual's tests look. Suites are also tests themselves, so they compose into a hierarchy.pic.twitter.com/lxVUXb7EBF
Show this thread -
Unit tests are a common case. But by removing control flow from the testing library's responsibilities, Probably can scale trivially run anywhere, from inside the REPL or the compiler, to an async production system, and everything in between, with the same simple model.
Show this thread
End of conversation
New conversation -
-
-
The readme nicely describes the "what" I wish there was more on the "why" :)
-
That can be added. :)
- Show replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.