A testing framework for Idris 2.
At least version 0.5.0
of the Idris 2 compiler is required.
idris2 --install tester.ipkg
After installing the package, add tester
to the depends
section in the .ipkg
file.
To construct a Test
, use the test
function from the Tester
module.
Multiple assertion functions are provided in the Tester
module as well.
itWorks = test "it works" $ do
assertEq (1 + 1) 2
To run a series of tests, the runTests
function in Tester.Runner
can be used.
import Tester
import Tester.Runner
tests : List Test
tests = [
itWorks
]
main : IO ()
main = do
success <- runTests tests
if success
then putStrLn "All tests passed"
else putStrLn "Not all tests passed"
Source location can be added to assertions to improve error messages.
import Language.Reflection
%language ElabReflection
withSource = test "location" $ do
assert
{loc = here `(())}
False
All code is licensed under the MPL-2.0.
All files that are not properly copyrightable are in the public domain, using the CC0 license.
This project aims to be REUSE compliant.