on master help sign in
Make tests pass on GHC 8.10
commitdec54b864a4b3b7d25033c1825b2c30482f98189 authorArtyom Kazak <artyom@artyom.me> dateThu 3 Sep 2020, 21:33 (6 years ago) parent2400689
2 files changed+17−5
test/JRecShouldNotTypecheckSpec.hs+15 test/JRecSpec.hs+2−5
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 #-}
21module JRecSpec (spec) where
32
43import Control.Lens ((&), (.~), (^.))
54import JRec
65import Test.Hspec
7−import Test.ShouldNotTypecheck
6+import GHC.Stack
87
9−spec :: Spec
8+spec :: HasCallStack => Spec
109spec = do
1110 it "polymorphic" $ do
1211 (Rec (#u := True, #a := 5, #b := 6, #a := 2 ) & #u .~ 5)
@@ -73,8 +72,6 @@ spec = do
7372 it "simple insert" $ do
7473 (#a := 1) `insert` Rec (#b := 2, #c := 3)
7574 `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'))
7875 describe "insertOrSet" $ do
7976 it "distinct" $ do
8077 insertOrSet (#a := 1) (Rec (#b := 2, #c := 3))