@@ -36,7 +36,7 @@ tests recorder = testGroup
36
36
" class"
37
37
[codeActionTests recorder , codeLensTests recorder]
38
38
39
- -- codeActionTests :: TestTree
39
+ codeActionTests :: Recorder ( WithPriority Class. Log ) -> TestTree
40
40
codeActionTests recorder = testGroup
41
41
" code actions"
42
42
[ testCase " Produces addMinimalMethodPlaceholders code actions for one instance" $ do
@@ -70,22 +70,22 @@ codeActionTests recorder = testGroup
70
70
, goldenWithClass recorder " Creates a placeholder for other two methods" " T6" " 2" $ \ (_: _: ghAction: _) -> do
71
71
executeCodeAction ghAction
72
72
, onlyRunForGhcVersions [GHC92 ] " Only ghc-9.2 enabled GHC2021 implicitly" $
73
- goldenWithClass recorder " Don't insert pragma with GHC2021" " T16 " " " $ \ (_: eqWithSig: _) -> do
73
+ goldenWithClass recorder " Don't insert pragma with GHC2021" " InsertWithGHC2021Enabled " " " $ \ (_: eqWithSig: _) -> do
74
74
executeCodeAction eqWithSig
75
- , goldenWithClass recorder " Insert pragma if not exist" " T7 " " " $ \ (_: eqWithSig: _) -> do
75
+ , goldenWithClass recorder " Insert pragma if not exist" " InsertWithoutPragma " " " $ \ (_: eqWithSig: _) -> do
76
76
executeCodeAction eqWithSig
77
- , goldenWithClass recorder " Don't insert pragma if exist" " T8 " " " $ \ (_: eqWithSig: _) -> do
77
+ , goldenWithClass recorder " Don't insert pragma if exist" " InsertWithPragma " " " $ \ (_: eqWithSig: _) -> do
78
78
executeCodeAction eqWithSig
79
- , goldenWithClass recorder " Only insert pragma once" " T9 " " " $ \ (_: multi: _) -> do
79
+ , goldenWithClass recorder " Only insert pragma once" " InsertPragmaOnce " " " $ \ (_: multi: _) -> do
80
80
executeCodeAction multi
81
81
]
82
82
83
- -- codeLensTests :: TestTree
83
+ codeLensTests :: Recorder ( WithPriority Class. Log ) -> TestTree
84
84
codeLensTests recorder = testGroup
85
85
" code lens"
86
86
[ testCase " Has code lens" $ do
87
87
runSessionWithServer (classPlugin recorder) testDataDir $ do
88
- doc <- openDoc " T10 .hs" " haskell"
88
+ doc <- openDoc " CodeLensSimple .hs" " haskell"
89
89
lens <- getCodeLenses doc
90
90
let titles = map (^. J. title) $ mapMaybe (^. J. command) lens
91
91
liftIO $ titles @?=
@@ -97,25 +97,27 @@ codeLensTests recorder = testGroup
97
97
sendConfigurationChanged
98
98
$ toJSON
99
99
$ def { Plugin. plugins = [(" class" , def { plcConfig = " typelensOn" .= False })] }
100
- doc <- openDoc " T10 .hs" " haskell"
100
+ doc <- openDoc " CodeLensSimple .hs" " haskell"
101
101
lens <- getCodeLenses doc
102
102
let titles = map (^. J. title) $ mapMaybe (^. J. command) lens
103
103
liftIO $ titles @?= []
104
- , goldenCodeLens recorder " Apply code lens" " T10 " 1
105
- , goldenCodeLens recorder " Apply code lens for local class" " T11 " 0
106
- , goldenCodeLens recorder " Apply code lens on the same line" " T12 " 0
107
- , goldenCodeLens recorder " Don't insert pragma while existing" " T13 " 0
104
+ , goldenCodeLens recorder " Apply code lens" " CodeLensSimple " 1
105
+ , goldenCodeLens recorder " Apply code lens for local class" " LocalClassDefine " 0
106
+ , goldenCodeLens recorder " Apply code lens on the same line" " Inline " 0
107
+ , goldenCodeLens recorder " Don't insert pragma while existing" " CodeLensWithPragma " 0
108
108
, onlyRunForGhcVersions [GHC92 ] " Only ghc-9.2 enabled GHC2021 implicitly" $
109
- goldenCodeLens recorder " Don't insert pragma while GHC2021 enabled" " T14" 0
110
- , goldenCodeLens recorder " Qualified name" " T15" 0
109
+ goldenCodeLens recorder " Don't insert pragma while GHC2021 enabled" " CodeLensWithGHC2021" 0
110
+ , goldenCodeLens recorder " Qualified name" " Qualified" 0
111
+ , goldenCodeLens recorder " Type family" " TypeFamily" 0
111
112
]
112
113
113
114
_CACodeAction :: Prism' (Command |? CodeAction ) CodeAction
114
115
_CACodeAction = prism' InR $ \ case
115
116
InR action -> Just action
116
117
_ -> Nothing
117
118
118
- -- goldenCodeLens :: TestName -> FilePath -> Int -> TestTree
119
+
120
+ goldenCodeLens :: Recorder (WithPriority Class. Log ) -> TestName -> FilePath -> Int -> TestTree
119
121
goldenCodeLens recorder title path idx =
120
122
goldenWithHaskellDoc (classPlugin recorder) title testDataDir path " expected" " hs" $ \ doc -> do
121
123
lens <- getCodeLenses doc
0 commit comments