Skip to main content

PureScript

Status

Beta

Versions

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
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
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
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
  • debug
  • effect
  • bigints
  • rationals
  • profunctor-lenses
  • spec
    • spec-discovery
    • spec-quickcheck

Packages are managed with psc-package using package set psc-0.12.2-20190119. See packages.json for versions.

Feel free to open issues for additional packages.

Services

None

Language ID

purescript