Skip to content

Language PureScript

kazk edited this page Oct 7, 2018 · 9 revisions

Status

Unreleased

Versions

0.12

Test Frameworks

spec

Example

The name of the solution module can be arbitrary. Extra module can be provided in preloaded code.

module Example where

import Prelude

add' :: Int -> Int -> Int
add' x y = x + y

The name of the test module must end with Spec.

module ExampleSpec where

import Prelude
import Test.Spec (Spec, describe, it)
import Test.Spec.Assertions (shouldEqual)

import Example (add')

spec :: Spec Unit
spec =
  describe "Example" do
    describe "add'" do
      it "returns sum" do
        (add' 1 1) `shouldEqual` 2

QuickCheck is supported.

module QuickCheckExampleSpec where

import Prelude
import Test.QuickCheck ((===))
import Test.Spec (Spec, describe, it)
import Test.Spec.QuickCheck (quickCheck)

spec :: Spec Unit
spec =
  describe "QuickCheck" do
    it "works" $
      quickCheck \n -> (n * 2 / 2) === n

Timeout

12 seconds

Packages

  • prelude
  • console
  • effect
  • spec
    • spec-discovery
    • spec-quickcheck

Packages are managed with psc-package using package set psc-0.12-0-20181005. See packages.json for versions.

Feel free to open issues for additional packages.

Services

None

Clone this wiki locally