|
| 1 | +{-# LANGUAGE OverloadedStrings #-} |
| 2 | + |
| 3 | +module ConstructorHoverTests (tests) where |
| 4 | + |
| 5 | +import Config |
| 6 | +import Hover |
| 7 | +import Test.Hls |
| 8 | +import Test.Hls.FileSystem (copyDir) |
| 9 | + |
| 10 | +tests :: TestTree |
| 11 | +tests = |
| 12 | + testGroup |
| 13 | + "constructor hover (#2904)" |
| 14 | + [ testGroup |
| 15 | + "Constructors.hs" |
| 16 | + [ test "A" "Constructors.hs" (Position 2 9) [ExpectHoverText ["A :: A"]] |
| 17 | + , test "B" "Constructors.hs" (Position 3 9) [ExpectHoverText ["B :: Int -> Word -> Bool -> B"], ExpectHoverExcludeText ["%1 ->"]] |
| 18 | + , test "C" "Constructors.hs" (Position 4 9) [ExpectHoverText ["C :: [Int] -> Bool -> C"], ExpectHoverExcludeText ["%1 ->"]] |
| 19 | + , test "D" "Constructors.hs" (Position 5 9) [ExpectHoverText ["D :: Int -> Bool -> D"], ExpectHoverExcludeText ["%1 ->"]] |
| 20 | + , test "E" "Constructors.hs" (Position 6 9) [ExpectHoverText ["E :: Int -> [Bool] -> E"], ExpectHoverExcludeText ["%1 ->"]] |
| 21 | + , test "F" "Constructors.hs" (Position 7 12) [ExpectHoverText ["F :: Int -> F"], ExpectHoverExcludeText ["%1 ->"]] |
| 22 | + ] |
| 23 | + , testGroup |
| 24 | + "ConstructorsLinear.hs" |
| 25 | + [ test "A" "ConstructorsLinear.hs" (Position 3 9) [ExpectHoverText ["A :: A"]] |
| 26 | + , test "B" "ConstructorsLinear.hs" (Position 4 9) [ExpectHoverText ["B :: Int %1 -> Word %1 -> Bool %1 -> B"]] |
| 27 | + , test "C" "ConstructorsLinear.hs" (Position 5 9) [ExpectHoverText ["C :: [Int] %1 -> Bool %1 -> C"]] |
| 28 | + , test "D" "ConstructorsLinear.hs" (Position 6 9) [ExpectHoverText ["D :: Int %1 -> Bool %1 -> D"]] |
| 29 | + , test "E" "ConstructorsLinear.hs" (Position 7 9) [ExpectHoverText ["E :: Int %1 -> [Bool] %1 -> E"]] |
| 30 | + , test "F" "ConstructorsLinear.hs" (Position 8 12) [ExpectHoverText ["F :: Int %1 -> F"]] |
| 31 | + ] |
| 32 | + ] |
| 33 | + |
| 34 | +test :: String -> FilePath -> Position -> [Expect] -> TestTree |
| 35 | +test title fileName pos expectations = |
| 36 | + testWithDummyPlugin title (mkIdeTestFs [copyDir "hover"]) $ do |
| 37 | + doc <- openDoc fileName "haskell" |
| 38 | + waitForProgressDone |
| 39 | + hover <- getHover doc pos |
| 40 | + checkHover hover expectations |
0 commit comments