You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It restores the eval plugin. Now annotations with comments are found by
walking the AST and locating specific annotations.
In order to fix unit test, I implemented a new golden test function
which accepts a different naming scheme depending on the GHC version.
Copy file name to clipboardExpand all lines: plugins/hls-eval-plugin/test/Main.hs
+31-19
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,4 @@
1
+
{-# LANGUAGE MultiWayIf #-}
1
2
{-# LANGUAGE OverloadedStrings #-}
2
3
{-# LANGUAGE RecordWildCards #-}
3
4
{-# LANGUAGE TypeApplications #-}
@@ -69,40 +70,43 @@ tests =
69
70
, goldenWithEval "Refresh a multiline evaluation""T7""hs"
70
71
, testCase "Semantic and Lexical errors are reported"$do
71
72
evalInFile "T8.hs""-- >>> noFunctionWithThisName""-- Variable not in scope: noFunctionWithThisName"
72
-
evalInFile "T8.hs""-- >>> \"a\" + \"bc\""$
73
-
if ghcVersion ==GHC90
74
-
then"-- No instance for (Num String) arising from a use of ‘+’"
75
-
else"-- No instance for (Num [Char]) arising from a use of ‘+’"
73
+
evalInFile "T8.hs""-- >>> res = \"a\" + \"bc\""$
74
+
if
75
+
| 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 ==GHC90->"-- No instance for (Num String) arising from a use of ‘+’"
77
+
|otherwise->"-- No instance for (Num [Char]) arising from a use of ‘+’"
76
78
evalInFile "T8.hs""-- >>> \"""-- lexical error in string/character literal at end of input"
77
79
evalInFile "T8.hs""-- >>> 3 `div` 0""-- divide by zero"
78
80
, goldenWithEval "Applies file LANGUAGE extensions""T9""hs"
79
-
, goldenWithEval "Evaluate a type with :kind!""T10""hs"
80
-
, goldenWithEval "Reports an error for an incorrect type with :kind!""T11""hs"
81
-
, goldenWithEval "Shows a kind with :kind""T12""hs"
82
-
, goldenWithEval "Reports an error for an incorrect type with :kind""T13""hs"
81
+
, goldenWithEval'"Evaluate a type with :kind!""T10""hs" (if ghcVersion ==GHC92then"ghc92.expected"else"expected")
82
+
, goldenWithEval'"Reports an error for an incorrect type with :kind!""T11""hs" (if ghcVersion ==GHC92then"ghc92.expected"else"expected")
83
+
, goldenWithEval'"Shows a kind with :kind""T12""hs" (if ghcVersion ==GHC92then"ghc92.expected"else"expected")
84
+
, goldenWithEval'"Reports an error for an incorrect type with :kind""T13""hs" (if ghcVersion ==GHC92then"ghc92.expected"else"expected")
83
85
, goldenWithEval "Returns a fully-instantiated type for :type""T14""hs"
84
-
, goldenWithEval "Returns an uninstantiated type for :type +v, admitting multiple whitespaces around arguments""T15""hs"
86
+
, 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"
85
87
, goldenWithEval "Returns defaulted type for :type +d, admitting multiple whitespaces around arguments""T16""hs"
86
-
, goldenWithEval ":type reports an error when given with unknown +x option""T17""hs"
88
+
, goldenWithEval'":type reports an error when given with unknown +x option""T17""hs" (if ghcVersion ==GHC92then"ghc92.expected"else"expected")
87
89
, goldenWithEval "Reports an error when given with unknown command""T18""hs"
88
90
, goldenWithEval "Returns defaulted type for :type +d reflecting the default declaration specified in the >>> prompt""T19""hs"
89
91
, expectFailBecause "known issue - see a note in P.R. #361"$
90
-
goldenWithEval ":type +d reflects the `default' declaration of the module""T20""hs"
92
+
goldenWithEval'":type +d reflects the `default' declaration of the module""T20""hs" (if ghcVersion ==GHC92then"ghc92.expected"else"expected")
91
93
, testCase ":type handles a multilined result properly"$
0 commit comments