Skip to content

Commit 8b0d729

Browse files
committed
Add tests for export unused top binding code action
For symbolic pattern synonyms, type families and type classes
1 parent 87b4d95 commit 8b0d729

File tree

1 file changed

+37
-0
lines changed
  • plugins/hls-refactor-plugin/test

1 file changed

+37
-0
lines changed

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

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3413,6 +3413,19 @@ exportUnusedTests = testGroup "export unused actions"
34133413
, "module A (pattern Foo) where"
34143414
, "pattern Foo a <- (a, _)"
34153415
]
3416+
, testSession "unused pattern synonym symbol" $ template
3417+
[ "{-# OPTIONS_GHC -Wunused-top-binds #-}"
3418+
, "{-# LANGUAGE PatternSynonyms #-}"
3419+
, "module A () where"
3420+
, "pattern x :+ y = (x, y)"
3421+
]
3422+
(R 3 0 3 12)
3423+
"Export ‘:+’"
3424+
[ "{-# OPTIONS_GHC -Wunused-top-binds #-}"
3425+
, "{-# LANGUAGE PatternSynonyms #-}"
3426+
, "module A (pattern (:+)) where"
3427+
, "pattern x :+ y = (x, y)"
3428+
]
34163429
, testSession "unused data type" $ template
34173430
[ "{-# OPTIONS_GHC -Wunused-top-binds #-}"
34183431
, "module A () where"
@@ -3459,6 +3472,19 @@ exportUnusedTests = testGroup "export unused actions"
34593472
, "module A (Foo) where"
34603473
, "type family Foo p"
34613474
]
3475+
, testSession "unused type family symbol" $ template
3476+
[ "{-# OPTIONS_GHC -Wunused-top-binds #-}"
3477+
, "{-# LANGUAGE TypeFamilies #-}"
3478+
, "module A () where"
3479+
, "type family p &&& q"
3480+
]
3481+
(R 3 0 3 10)
3482+
"Export ‘&&&’"
3483+
[ "{-# OPTIONS_GHC -Wunused-top-binds #-}"
3484+
, "{-# LANGUAGE TypeFamilies #-}"
3485+
, "module A (type (&&&)) where"
3486+
, "type family p &&& q"
3487+
]
34623488
, testSession "unused typeclass" $ template
34633489
[ "{-# OPTIONS_GHC -Wunused-top-binds #-}"
34643490
, "module A () where"
@@ -3470,6 +3496,17 @@ exportUnusedTests = testGroup "export unused actions"
34703496
, "module A (Foo(..)) where"
34713497
, "class Foo a"
34723498
]
3499+
, testSession "unused typeclass symbol" $ template
3500+
[ "{-# OPTIONS_GHC -Wunused-top-binds #-}"
3501+
, "module A () where"
3502+
, "class p &&& q"
3503+
]
3504+
(R 2 0 2 10)
3505+
"Export ‘&&&’"
3506+
[ "{-# OPTIONS_GHC -Wunused-top-binds #-}"
3507+
, "module A (type (&&&)(..)) where"
3508+
, "class p &&& q"
3509+
]
34733510
, testSession "infix" $ template
34743511
[ "{-# OPTIONS_GHC -Wunused-top-binds #-}"
34753512
, "module A () where"

0 commit comments

Comments
 (0)