Skip to content

dannypsnl/control-spec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Control Spec

The project is a unit test framework for idris2, it follows the app structure.

Installation

git clone git@github.com:dannypsnl/control-spec.git
cd control-spec && pack install control-spec
# install spec-discover
pack install-app control-spec
export PATH=${HOME}/.pack/bin

Usage

You can write a Spec as below in a file named test/src/XxxSpec.idr

import Control.App
import Control.App.Spec

export
spec : Spec e => App e ()
spec = describe "example" $ do
  context "arith" $ do
    it "1+1 = 2" $ 1+1 `shouldBe` 2
    it "1*1 = 1" $ 1*1 `shouldBe` 1

spec-discover

Then use spec-discover to generate all tests runner!

spec-discover test/
idris2 --build test/test.ipkg
./test/build/exec/runAllTests

You might want to ignore test/src/Main.idr and test/test.ipkg in git repository.

pack user

spec-discover test/
pack test <your-package>