Skip to content

Commit

Permalink
Add a test to verify that we don't violate parametricity
Browse files Browse the repository at this point in the history
  • Loading branch information
ajnsit committed Nov 27, 2019
1 parent e78d4fe commit aaef27f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Test.Main where
import Prelude

import Data.Maybe (Maybe(..))
import Data.Nullable (toNullable, toMaybe)
import Data.Nullable (toNullable, toMaybe, null, Nullable)
import Effect (Effect)
import Test.Assert (assertEqual)

Expand All @@ -25,3 +25,13 @@ main = do
{ actual: toNullable Nothing `compare` toNullable (Just 42)
, expected: LT
}
assertEqual
{ actual: toMaybe (toNullable (Just 1)) == Just 1
, expected: true
}
-- Make sure we don't violate parametricity (See https://github.com/purescript-contrib/purescript-nullable/issues/7)
let (nullInt::Nullable Int) = null
assertEqual
{ actual: toMaybe (toNullable (Just nullInt)) == Just nullInt
, expected: true
}

0 comments on commit aaef27f

Please sign in to comment.