on master help sign in
Add goto/hover tests for type constructors from other package (#167)
23ff249Jacek Generowicz
test/exe/Main.hs+45−41
@@ -740,62 +740,66 @@ findDefinitionTests = let
740 yes, broken :: (TestTree -> Maybe TestTree)
740 yes, broken :: (TestTree -> Maybe TestTree)
741 yes = Just -- test should run and pass
741 yes = Just -- test should run and pass
742 broken = Just . (`xfail` "known broken")
742 broken = Just . (`xfail` "known broken")
743+ cant = Just . (`xfail` "cannot be made to work")
743-- no = const Nothing -- don't run this test at all
744-- no = const Nothing -- don't run this test at all
744
745
745 source = T.unlines
746 source = T.unlines
746 -- 0123456789 123456789 123456789 123456789
747 -- 0123456789 123456789 123456789 123456789
747 [ "{-# OPTIONS_GHC -Wmissing-signatures #-}" -- 0
748 [ "{-# OPTIONS_GHC -Wmissing-signatures #-}" -- 0
748 , "module Testing where" -- 1
749 , "module Testing where" -- 1
750+ , "import Data.Text (Text)" -- 2
749− , "data TypeConstructor = DataConstructor" -- 2
751+ , "data TypeConstructor = DataConstructor" -- 3
750− , " { fff :: String" -- 3
752+ , " { fff :: Text" -- 4
751− , " , ggg :: Int }" -- 4
753+ , " , ggg :: Int }" -- 5
752− , "aaa :: TypeConstructor" -- 5
754+ , "aaa :: TypeConstructor" -- 6
753− , "aaa = DataConstructor" -- 6
755+ , "aaa = DataConstructor" -- 7
754− , " { fff = \"\"" -- 7
756+ , " { fff = \"\"" -- 8
755− , " , ggg = 0" -- 8
757+ , " , ggg = 0" -- 9
756− , " }" -- 9
757 -- 0123456789 123456789 123456789 123456789
758 -- 0123456789 123456789 123456789 123456789
759+ , " }" -- 10
758− , "bbb :: TypeConstructor" -- 10
760+ , "bbb :: TypeConstructor" -- 11
759− , "bbb = DataConstructor \"\" 0" -- 11
761+ , "bbb = DataConstructor \"\" 0" -- 12
760− , "ccc :: (String, Int)" -- 12
762+ , "ccc :: (Text, Int)" -- 13
761− , "ccc = (fff bbb, ggg aaa)" -- 13
763+ , "ccc = (fff bbb, ggg aaa)" -- 14
762− , "ddd :: Num a => a -> a -> a" -- 14
764+ , "ddd :: Num a => a -> a -> a" -- 15
763− , "ddd vv ww = vv +! ww" -- 15
765+ , "ddd vv ww = vv +! ww" -- 16
764− , "a +! b = a - b" -- 16
766+ , "a +! b = a - b" -- 17
765− , "hhh (Just a) (><) = a >< a" -- 17
767+ , "hhh (Just a) (><) = a >< a" -- 18
766− , "iii a b = a `b` a" -- 18
768+ , "iii a b = a `b` a" -- 19
767 -- 0123456789 123456789 123456789 123456789
769 -- 0123456789 123456789 123456789 123456789
768 ]
770 ]
769
771
770 -- search locations definition locations
772 -- search locations definition locations
771− fffL3 = _start fff ; fff = mkRange 3 4 3 7
773+ fffL4 = _start fff ; fff = mkRange 4 4 4 7
772− fffL7 = Position 7 4 ;
774+ fffL8 = Position 8 4 ;
773− fffL13 = Position 13 7 ;
775+ fffL14 = Position 14 7 ;
774− aaaL13 = Position 13 20 ; aaa = mkRange 6 0 6 3
776+ aaaL14 = Position 14 20 ; aaa = mkRange 7 0 7 3
775− dcL6 = Position 6 11 ; tcDC = mkRange 2 23 4 16
777+ dcL7 = Position 7 11 ; tcDC = mkRange 3 23 5 16
776− dcL11 = Position 11 11 ;
778+ dcL12 = Position 12 11 ;
779+ xtcL5 = Position 5 11 ; xtc = undefined -- not clear what it should do
777− tcL5 = Position 5 11 ; tcData = mkRange 2 0 4 16
780+ tcL6 = Position 6 11 ; tcData = mkRange 3 0 5 16
778− vvL15 = Position 15 12 ; vv = mkRange 15 4 15 6
781+ vvL16 = Position 16 12 ; vv = mkRange 16 4 16 6
779− opL15 = Position 15 15 ; op = mkRange 16 2 16 4
782+ opL16 = Position 16 15 ; op = mkRange 17 2 17 4
780− opL17 = Position 17 22 ; opp = mkRange 17 13 17 17
783+ opL18 = Position 18 22 ; opp = mkRange 18 13 18 17
781− aL17 = Position 17 20 ; apmp = mkRange 17 10 17 11
784+ aL18 = Position 18 20 ; apmp = mkRange 18 10 18 11
782− b'L18 = Position 18 13 ; bp = mkRange 18 6 18 7
785+ b'L19 = Position 19 13 ; bp = mkRange 19 6 19 7
783
786
784 in
787 in
785 mkFindTests
788 mkFindTests
786 -- def hover look bind
789 -- def hover look bind
787− [ test yes yes fffL3 fff "field in record definition"
790+ [ test yes yes fffL4 fff "field in record definition"
788− , test broken broken fffL7 fff "field in record construction"
791+ , test broken broken fffL8 fff "field in record construction"
789− , test yes yes fffL13 fff "field name used as accessor" -- 120 in Calculate.hs
792+ , test yes yes fffL14 fff "field name used as accessor" -- 120 in Calculate.hs
790− , test yes yes aaaL13 aaa "top-level name" -- 120
793+ , test yes yes aaaL14 aaa "top-level name" -- 120
791− , test broken broken dcL6 tcDC "record data constructor"
794+ , test broken broken dcL7 tcDC "record data constructor"
792− , test yes yes dcL11 tcDC "plain data constructor" -- 121
795+ , test yes yes dcL12 tcDC "plain data constructor" -- 121
793− , test yes broken tcL5 tcData "type constructor" -- 147
796+ , test yes broken tcL6 tcData "type constructor" -- 147
797+ , test cant broken xtcL5 xtc "type constructor from other package"
794− , test yes yes vvL15 vv "plain parameter"
798+ , test yes yes vvL16 vv "plain parameter"
795− , test yes yes aL17 apmp "pattern match name"
799+ , test yes yes aL18 apmp "pattern match name"
796− , test yes yes opL15 op "top-level operator" -- 123
800+ , test yes yes opL16 op "top-level operator" -- 123
797− , test yes yes opL17 opp "parameter operator"
801+ , test yes yes opL18 opp "parameter operator"
798− , test yes yes b'L18 bp "name in backticks"
802+ , test yes yes b'L19 bp "name in backticks"
799 ]
803 ]
800
804
801xfail :: TestTree -> String -> TestTree
805xfail :: TestTree -> String -> TestTree