Skip to content

Commit 88f063f

Browse files
author
kokobd
committed
add more tests
1 parent 481acf4 commit 88f063f

File tree

6 files changed

+36
-3
lines changed

6 files changed

+36
-3
lines changed

plugins/hls-haddock-comments-plugin/src/Ide/Plugin/HaddockComments/Data.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import Language.Haskell.GHC.ExactPrint.Utils (mkComment)
2525
genForDataDecl :: GenComments
2626
genForDataDecl =
2727
GenComments {
28-
title = "Generate fields comments",
28+
title = "Generate haddock comments",
2929
updateAnns = updateDataAnns
3030
}
3131

plugins/hls-haddock-comments-plugin/test/Main.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ tests =
3030
goldenWithHaddockComments "MultivariateFunction" Signature 4 8,
3131
goldenWithHaddockComments "QualFunction" Signature 2 10,
3232
goldenWithHaddockComments "Record" Record 7 2,
33+
goldenWithHaddockComments "Record2" Record 3 6,
34+
goldenWithHaddockComments "InlineRecord" Record 3 20,
3335
expectedNothing "ConstFunction" Signature 2 2,
3436
expectedNothing "StaleFunction" Signature 3 3,
35-
expectedNothing "StaleRecord" Record 3 12
37+
expectedNothing "StaleRecord" Record 4 9
3638
]
3739

3840
goldenWithHaddockComments :: FilePath -> GenCommentsType -> UInt -> UInt -> TestTree
@@ -54,7 +56,7 @@ data GenCommentsType = Signature | Record
5456

5557
toTitle :: GenCommentsType -> Text
5658
toTitle Signature = "Generate signature comments"
57-
toTitle Record = "Generate fields comments"
59+
toTitle Record = "Generate haddock comments"
5860

5961
caTitle :: (Command |? CodeAction) -> Maybe Text
6062
caTitle (InR CodeAction {_title}) = Just _title
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module Record2 where
2+
3+
-- | A record
4+
data Record = -- |
5+
A { -- |
6+
a :: Int , -- |
7+
b :: String }
8+
| -- |
9+
B { -- |
10+
bb :: Double }
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Record2 where
2+
3+
-- | A record
4+
data Record = A { a :: Int , b :: String } | B { bb :: Double }
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module Record2 where
2+
3+
-- | A record
4+
data Record = -- |
5+
RecordA
6+
{ -- |
7+
a :: Int
8+
, -- |
9+
b :: String
10+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module Record2 where
2+
3+
-- | A record
4+
data Record = RecordA
5+
{ a :: Int
6+
, b :: String
7+
}

0 commit comments

Comments
 (0)