@@ -1,12 +1,11 @@
1−{-# OPTIONS_GHC -fdefer-type-errors #-}
2module JRecSpec (spec) where
1module JRecSpec (spec) where
4import Control.Lens ((&), (.~), (^.))
3import Control.Lens ((&), (.~), (^.))
6import Test.Hspec
5import Test.Hspec
7−import Test.ShouldNotTypecheck
6+import GHC.Stack
9−spec :: Spec
8+spec :: HasCallStack => Spec
11 it "polymorphic" $ do
10 it "polymorphic" $ do
12 (Rec (#u := True, #a := 5, #b := 6, #a := 2 ) & #u .~ 5)
11 (Rec (#u := True, #a := 5, #b := 6, #a := 2 ) & #u .~ 5)
@@ -73,8 +72,6 @@ spec = do
73 it "simple insert" $ do
72 it "simple insert" $ do
74 (#a := 1) `insert` Rec (#b := 2, #c := 3)
73 (#a := 1) `insert` Rec (#b := 2, #c := 3)
75 `shouldBe` Rec (#a := 1, #b := 2, #c := 3)
74 `shouldBe` Rec (#a := 1, #b := 2, #c := 3)
76− it "type-check fails if field already exists" $ do
77− shouldNotTypecheck ((#a := '1') `insert` Rec (#b := '2', #a := '0'))
78 describe "insertOrSet" $ do
75 describe "insertOrSet" $ do
79 it "distinct" $ do
76 it "distinct" $ do
80 insertOrSet (#a := 1) (Rec (#b := 2, #c := 3))
77 insertOrSet (#a := 1) (Rec (#b := 2, #c := 3))