on master help sign in
Make tests pass on GHC 8.10
dec54b8Artyom Kazak
test/JRecShouldNotTypecheckSpec.hsnew file+15
@@ -0,0 +1,15 @@
1+{-# OPTIONS_GHC -fdefer-type-errors #-}
2+
3+module JRecShouldNotTypecheckSpec (spec) where
4+
5+import Control.Lens ((&), (.~), (^.))
6+import JRec
7+import Test.Hspec
8+import Test.ShouldNotTypecheck
9+import GHC.Stack
10+
11+spec :: Spec
12+spec = do
13+ describe "insert" $ do
14+ it "type-check fails if field already exists" $ do
15+ shouldNotTypecheck ((#a := '1') `insert` Rec (#b := '2', #a := '0'))
test/JRecSpec.hs+2−5
@@ -1,12 +1,11 @@
1−{-# OPTIONS_GHC -fdefer-type-errors #-}
2module JRecSpec (spec) where
1module JRecSpec (spec) where
3
2
4import Control.Lens ((&), (.~), (^.))
3import Control.Lens ((&), (.~), (^.))
5import JRec
4import JRec
6import Test.Hspec
5import Test.Hspec
7−import Test.ShouldNotTypecheck
6+import GHC.Stack
8
7
9−spec :: Spec
8+spec :: HasCallStack => Spec
10spec = do
9spec = do
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))