Skip to content

Commit 8efc4e8

Browse files
Comment in and disable test for prefixing unused names with "_".
Currently we have no support for this code action. But if the test is going to live in this file it might as well be typechecked.
1 parent 3db418e commit 8efc4e8

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

test/functional/FunctionalCodeAction.hs

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -404,32 +404,31 @@ missingPragmaTests = testGroup "missing pragma warning code actions" [
404404

405405
unusedTermTests :: TestTree
406406
unusedTermTests = testGroup "unused term code actions" [
407-
-- ignoreTestBecause "Broken" $ testCase "Prefixes with '_'" $ pendingWith "removed because of HaRe"
408-
-- runSession hlsCommand fullCaps "test/testdata/" $ do
409-
-- doc <- openDoc "UnusedTerm.hs" "haskell"
410-
--
411-
-- _ <- waitForDiagnosticsSource "typecheck"
412-
-- cas <- map fromAction <$> getAllCodeActions doc
413-
--
414-
-- liftIO $ map (^. L.title) cas `shouldContain` [ "Prefix imUnused with _"]
415-
--
416-
-- executeCodeAction $ head cas
417-
--
418-
-- edit <- skipManyTill anyMessage $ getDocumentEdit doc
419-
--
420-
-- let expected = [ "{-# OPTIONS_GHC -Wall #-}"
421-
-- , "module UnusedTerm () where"
422-
-- , "_imUnused :: Int -> Int"
423-
-- , "_imUnused 1 = 1"
424-
-- , "_imUnused 2 = 2"
425-
-- , "_imUnused _ = 3"
426-
-- ]
427-
--
428-
-- liftIO $ edit @?= T.unlines expected
407+
ignoreTestBecause "no support for prefixing unused names with _" $ testCase "Prefixes with '_'" $
408+
runSession hlsCommand fullCaps "test/testdata/" $ do
409+
doc <- openDoc "UnusedTerm.hs" "haskell"
410+
411+
_ <- waitForDiagnosticsSource "typecheck"
412+
cars <- getAllCodeActions doc
413+
prefixImUnused <- liftIO $ inspectCodeAction cars ["Prefix imUnused with _"]
414+
415+
executeCodeAction prefixImUnused
416+
417+
edit <- skipManyTill anyMessage $ getDocumentEdit doc
418+
419+
let expected = [ "{-# OPTIONS_GHC -Wall #-}"
420+
, "module UnusedTerm () where"
421+
, "_imUnused :: Int -> Int"
422+
, "_imUnused 1 = 1"
423+
, "_imUnused 2 = 2"
424+
, "_imUnused _ = 3"
425+
]
426+
427+
liftIO $ edit @?= T.unlines expected
429428

430429
-- See https://microsoft.github.io/language-server-protocol/specifications/specification-3-15/#textDocument_codeAction
431430
-- `CodeActionContext`
432-
testCase "respect 'only' parameter" $ runSession hlsCommand fullCaps "test/testdata" $ do
431+
, testCase "respect 'only' parameter" $ runSession hlsCommand fullCaps "test/testdata" $ do
433432
doc <- openDoc "CodeActionOnly.hs" "haskell"
434433
_ <- waitForDiagnostics
435434
diags <- getCurrentDiagnostics doc

0 commit comments

Comments
 (0)