Skip to content

Polymorphism

Background

Given a file named "pen.json" with:

{
  "type": "library",
  "dependencies": {}
}

Use an equal operator

Given a file named "Foo.pen" with:

f = \(x number | none) boolean {
  x == none
}

When I run pen build

Then the exit status should be 0.

Use a not-equal operator

Given a file named "Foo.pen" with:

f = \(x number | none) boolean {
  x != none
}

When I run pen build

Then the exit status should be 0.

Compare unions

Given a file named "Foo.pen" with:

f = \(x number | none, y number | none) boolean {
  x == y
}

When I run pen build

Then the exit status should be 0.

Compare a union and none

Given a file named "Foo.pen" with:

f = \(x number | none) boolean {
  x == none
}

When I run pen build

Then the exit status should be 0.