Skip to content

Commit 4e8178d

Browse files
jacgcocreature
authored andcommitted
Tests for issue #237 (#238)
* Add tests for issue #237 * Tell hlint to ignore test sample code * Add test showing similar problem in listcomps * Identify implementation necessary for test to pass
1 parent 9feb7c7 commit 4e8178d

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

test/data/GotoHover.hs

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
{- HLINT ignore -}
22
module Testing ( module Testing )where
33
import Data.Text (Text, pack)
44
data TypeConstructor = DataConstructor
@@ -25,3 +25,10 @@ instance Class Int where
2525
method = succ
2626
kkk :: Class a => Int -> a -> Int
2727
kkk n c = n + method c
28+
29+
doBind :: Maybe ()
30+
doBind = do unwrapped <- Just ()
31+
return unwrapped
32+
33+
listCompBind :: [Char]
34+
listCompBind = [ succ c | c <- "abc" ]

test/exe/Main.hs

+9-1
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,10 @@ findDefinitionAndHoverTests = let
786786
clL23 = Position 23 11 ; cls = [mkR 21 0 22 20]
787787
clL25 = Position 25 9
788788
eclL15 = Position 15 8 ; ecls = [ExpectHoverText ["Num"], ExpectExternFail]
789+
dnbL29 = Position 29 18 ; dnb = [ExpectHoverText [":: ()"], mkR 29 12 29 21]
790+
dnbL30 = Position 30 23
791+
lcbL33 = Position 33 26 ; lcb = [ExpectHoverText [":: Char"], mkR 33 26 33 27]
792+
lclL33 = Position 33 22
789793
in
790794
mkFindTests
791795
-- def hover look expect
@@ -806,11 +810,15 @@ findDefinitionAndHoverTests = let
806810
, test yes broken clL23 cls "class in instance declaration"
807811
, test yes broken clL25 cls "class in signature" -- 147
808812
, test broken broken eclL15 ecls "external class in signature"
813+
, test yes broken dnbL29 dnb "do-notation bind" -- 137
814+
, test yes yes dnbL30 dnb "do-notation lookup"
815+
, test yes broken lcbL33 lcb "listcomp bind" -- 137
816+
, test yes yes lclL33 lcb "listcomp lookup"
809817
]
810818
where yes, broken :: (TestTree -> Maybe TestTree)
811819
yes = Just -- test should run and pass
812820
broken = Just . (`xfail` "known broken")
813-
-- no = const Nothing -- don't run this test at all
821+
-- no = const Nothing -- don't run this test at all
814822

815823
pluginTests :: TestTree
816824
pluginTests = testSessionWait "plugins" $ do

0 commit comments

Comments
 (0)