Skip to content

Commit ea6093c

Browse files
committed
Add test for deleting unused bindings with Haddock docs
Co-authored-by: kunduagam23@gmail.com
1 parent 28c8760 commit ea6093c

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

  • plugins/hls-refactor-plugin/test

plugins/hls-refactor-plugin/test/Main.hs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2533,6 +2533,45 @@ deleteUnusedDefinitionTests = testGroup "delete unused definition action"
25332533
, ""
25342534
, "some = ()"
25352535
]
2536+
, testSession "delete unused top level binding with Haddock comment" $
2537+
testFor
2538+
[ "{-# OPTIONS_GHC -Wunused-top-binds #-}"
2539+
, "module A (some) where"
2540+
, ""
2541+
, "-- | docs for f"
2542+
, "f :: Int"
2543+
, "f = 1"
2544+
, ""
2545+
, "some = ()"
2546+
]
2547+
(5, 0)
2548+
1
2549+
"Delete ‘f’"
2550+
[ "{-# OPTIONS_GHC -Wunused-top-binds #-}"
2551+
, "module A (some) where"
2552+
, ""
2553+
, "some = ()"
2554+
]
2555+
, testSession "delete unused top level binding with block Haddock comment" $
2556+
testFor
2557+
[ "{-# OPTIONS_GHC -Wunused-top-binds #-}"
2558+
, "module A (some) where"
2559+
, ""
2560+
, "{-| docs for f"
2561+
, "-}"
2562+
, "f :: Int"
2563+
, "f = 1"
2564+
, ""
2565+
, "some = ()"
2566+
]
2567+
(6, 0)
2568+
1
2569+
"Delete ‘f’"
2570+
[ "{-# OPTIONS_GHC -Wunused-top-binds #-}"
2571+
, "module A (some) where"
2572+
, ""
2573+
, "some = ()"
2574+
]
25362575
, testSession "delete unused binding in where clause" $
25372576
testFor
25382577
[ "{-# OPTIONS_GHC -Wunused-binds #-}"

0 commit comments

Comments
 (0)