Skip to content

Test

Background

Given a file named "pen.json" with:

{
  "type": "library",
  "dependencies": {
    "Test": "pen:///test"
  }
}

Check if a condition is true

Given a file named "foo.test.pen" with:

import Test'Assert

Foo = \() none | error {
  Assert'True(true)
}

When I run pen test

Then the exit status should be 0.

Check if a value is an error

Given a file named "foo.test.pen" with:

import Test'Assert

Foo = \() none | error {
  Assert'Error(error(none))
}

When I run pen test

Then the exit status should be 0.

Make a test fail

Given a file named "foo.test.pen" with:

import Test'Assert

Foo = \() none | error {
  Assert'Fail()
}

When I run pen test

Then the exit status should be 1.