Skip to content

Commit 692ade2

Browse files
committed
Update partially hls-eval-plugin tests to ghc94
1 parent a19c09c commit 692ade2

File tree

3 files changed

+26
-13
lines changed

3 files changed

+26
-13
lines changed

plugins/hls-eval-plugin/hls-eval-plugin.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ library
101101
TypeOperators
102102

103103
test-suite tests
104-
if impl(ghc >= 9.3)
104+
if impl(ghc >= 9.5)
105105
buildable: False
106106
else
107107
buildable: True

plugins/hls-eval-plugin/test/Main.hs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,29 +73,29 @@ tests =
7373
evalInFile "T8.hs" "-- >>> noFunctionWithThisName" "-- Variable not in scope: noFunctionWithThisName"
7474
evalInFile "T8.hs" "-- >>> res = \"a\" + \"bc\"" $
7575
if
76-
| ghcVersion == GHC92 -> "-- No instance for (Num String) arising from a use of `+'\n-- In the expression: \"a\" + \"bc\"\n-- In an equation for `res': res = \"a\" + \"bc\""
76+
| ghcVersion >= GHC92 -> "-- No instance for (Num String) arising from a use of `+'\n-- In the expression: \"a\" + \"bc\"\n-- In an equation for `res': res = \"a\" + \"bc\""
7777
| ghcVersion == GHC90 -> "-- No instance for (Num String) arising from a use of ‘+’"
7878
| otherwise -> "-- No instance for (Num [Char]) arising from a use of ‘+’"
7979
evalInFile "T8.hs" "-- >>> \"" "-- lexical error in string/character literal at end of input"
8080
evalInFile "T8.hs" "-- >>> 3 `div` 0" "-- divide by zero" -- The default for marking exceptions is False
8181
, goldenWithEval "Applies file LANGUAGE extensions" "T9" "hs"
82-
, goldenWithEval' "Evaluate a type with :kind!" "T10" "hs" (if ghcVersion == GHC92 then "ghc92.expected" else "expected")
83-
, goldenWithEval' "Reports an error for an incorrect type with :kind!" "T11" "hs" (if ghcVersion == GHC92 then "ghc92.expected" else "expected")
84-
, goldenWithEval' "Shows a kind with :kind" "T12" "hs" (if ghcVersion == GHC92 then "ghc92.expected" else "expected")
85-
, goldenWithEval' "Reports an error for an incorrect type with :kind" "T13" "hs" (if ghcVersion == GHC92 then "ghc92.expected" else "expected")
82+
, goldenWithEval' "Evaluate a type with :kind!" "T10" "hs" (if ghcVersion >= GHC92 then "ghc92.expected" else "expected")
83+
, goldenWithEval' "Reports an error for an incorrect type with :kind!" "T11" "hs" (if ghcVersion >= GHC92 then "ghc92.expected" else "expected")
84+
, goldenWithEval' "Shows a kind with :kind" "T12" "hs" (if ghcVersion >= GHC92 then "ghc92.expected" else "expected")
85+
, goldenWithEval' "Reports an error for an incorrect type with :kind" "T13" "hs" (if ghcVersion >= GHC92 then "ghc92.expected" else "expected")
8686
, goldenWithEval "Returns a fully-instantiated type for :type" "T14" "hs"
8787
, knownBrokenForGhcVersions [GHC92] "type +v does not work anymore with 9.2" $ goldenWithEval "Returns an uninstantiated type for :type +v, admitting multiple whitespaces around arguments" "T15" "hs"
8888
, goldenWithEval "Returns defaulted type for :type +d, admitting multiple whitespaces around arguments" "T16" "hs"
89-
, goldenWithEval' ":type reports an error when given with unknown +x option" "T17" "hs" (if ghcVersion == GHC92 then "ghc92.expected" else "expected")
89+
, goldenWithEval' ":type reports an error when given with unknown +x option" "T17" "hs" (if ghcVersion >= GHC92 then "ghc92.expected" else "expected")
9090
, goldenWithEval "Reports an error when given with unknown command" "T18" "hs"
9191
, goldenWithEval "Returns defaulted type for :type +d reflecting the default declaration specified in the >>> prompt" "T19" "hs"
9292
, expectFailBecause "known issue - see a note in P.R. #361" $
93-
goldenWithEval' ":type +d reflects the `default' declaration of the module" "T20" "hs" (if ghcVersion == GHC92 then "ghc92.expected" else "expected")
93+
goldenWithEval' ":type +d reflects the `default' declaration of the module" "T20" "hs" (if ghcVersion >= GHC92 then "ghc92.expected" else "expected")
9494
, testCase ":type handles a multilined result properly" $
9595
evalInFile "T21.hs" "-- >>> :type fun" $ T.unlines [
9696
"-- fun",
9797
if
98-
| ghcVersion == GHC92 -> "-- :: forall {k1} (k2 :: Nat) (n :: Nat) (a :: k1)."
98+
| ghcVersion >= GHC92 -> "-- :: forall {k1} (k2 :: Nat) (n :: Nat) (a :: k1)."
9999
| ghcVersion == GHC90 -> "-- :: forall {k1} {k2 :: Nat} {n :: Nat} {a :: k1}."
100100
| otherwise -> "-- :: forall k1 (k2 :: Nat) (n :: Nat) (a :: k1).",
101101
"-- (KnownNat k2, KnownNat n, Typeable a) =>",
@@ -105,7 +105,7 @@ tests =
105105
, testCase ":type does \"dovetails\" for short identifiers" $
106106
evalInFile "T23.hs" "-- >>> :type f" $ T.unlines [
107107
if
108-
| ghcVersion == GHC92 -> "-- f :: forall {k1} (k2 :: Nat) (n :: Nat) (a :: k1)."
108+
| ghcVersion >= GHC92 -> "-- f :: forall {k1} (k2 :: Nat) (n :: Nat) (a :: k1)."
109109
| ghcVersion == GHC90 -> "-- f :: forall {k1} {k2 :: Nat} {n :: Nat} {a :: k1}."
110110
| otherwise -> "-- f :: forall k1 (k2 :: Nat) (n :: Nat) (a :: k1).",
111111
"-- (KnownNat k2, KnownNat n, Typeable a) =>",
@@ -124,17 +124,17 @@ tests =
124124
, goldenWithEval "Transitive local dependency" "TTransitive" "hs"
125125
-- , goldenWithEval "Local Modules can be imported in a test" "TLocalImportInTest" "hs"
126126
, goldenWithEval "Setting language option TupleSections" "TLanguageOptionsTupleSections" "hs"
127-
, goldenWithEval' ":set accepts ghci flags" "TFlags" "hs" (if ghcVersion == GHC92 then "ghc92.expected" else "expected")
127+
, goldenWithEval' ":set accepts ghci flags" "TFlags" "hs" (if ghcVersion >= GHC92 then "ghc92.expected" else "expected")
128128
, testCase ":set -fprint-explicit-foralls works" $ do
129129
evalInFile "T8.hs" "-- >>> :t id" "-- id :: a -> a"
130130
evalInFile "T8.hs" "-- >>> :set -fprint-explicit-foralls\n-- >>> :t id"
131-
(if ghcVersion == GHC92
131+
(if ghcVersion >= GHC92
132132
then "-- id :: forall a. a -> a"
133133
else "-- id :: forall {a}. a -> a")
134134
, goldenWithEval "The default language extensions for the eval plugin are the same as those for ghci" "TSameDefaultLanguageExtensionsAsGhci" "hs"
135135
, goldenWithEval "IO expressions are supported, stdout/stderr output is ignored" "TIO" "hs"
136136
, goldenWithEval "Property checking" "TProperty" "hs"
137-
, goldenWithEval "Property checking with exception" "TPropertyError" "hs"
137+
, goldenWithEval' "Property checking with exception" "TPropertyError" "hs" (if ghcVersion >= GHC94 then "ghc94.expected" else "expected")
138138
, goldenWithEval "Prelude has no special treatment, it is imported as stated in the module" "TPrelude" "hs"
139139
, goldenWithEval "Don't panic on {-# UNPACK #-} pragma" "TUNPACK" "hs"
140140
, goldenWithEval "Can handle eval inside nested comment properly" "TNested" "hs"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
-- Support for property checking
2+
module TProperty where
3+
4+
-- prop> \(l::[Bool]) -> head l
5+
-- *** Failed! (after 1 test):
6+
-- Exception:
7+
-- Prelude.head: empty list
8+
-- CallStack (from HasCallStack):
9+
-- error, called at libraries/base/GHC/List.hs:1646:3 in base:GHC.List
10+
-- errorEmptyList, called at libraries/base/GHC/List.hs:85:11 in base:GHC.List
11+
-- badHead, called at libraries/base/GHC/List.hs:81:28 in base:GHC.List
12+
-- head, called at <interactive>:1:27 in interactive:Ghci2
13+
-- []

0 commit comments

Comments
 (0)