summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Allen <aaron@flipstone.com>2020-12-06 17:29:29 -0600
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-12-11 12:58:14 -0500
commit5eba91b629745746397ed36f25fe592d08ec667b (patch)
treebe582584864216f07b73b88538cfeacd53d08d97
parent4548d1f8a2356458ded83f26a728c31159b46a56 (diff)
downloadhaskell-5eba91b629745746397ed36f25fe592d08ec667b.tar.gz
Add :doc test case for duplicate record fields
Tests that the output of the `:doc` command is correct for duplicate record fields defined using -XDuplicateRecordFields.
-rw-r--r--testsuite/tests/ghci/scripts/ghci065.hs13
-rw-r--r--testsuite/tests/ghci/scripts/ghci065.script1
-rw-r--r--testsuite/tests/ghci/scripts/ghci065.stdout3
3 files changed, 17 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/scripts/ghci065.hs b/testsuite/tests/ghci/scripts/ghci065.hs
index 8ff89cd12e..7d6d0cc497 100644
--- a/testsuite/tests/ghci/scripts/ghci065.hs
+++ b/testsuite/tests/ghci/scripts/ghci065.hs
@@ -5,6 +5,7 @@
-- this test is constructed with simple text (without markup) only.
--
+{-# LANGUAGE DuplicateRecordFields #-}
module Test where
-- | This is the haddock comment of a data declaration for Data1.
@@ -21,6 +22,18 @@ newtype Data4 =
-- | This is the haddock comment of a data constructor for Data4.
Data4 { getData4 :: Int }
+data DupeFields1 =
+ DF1 { dupeField :: Int -- ^ This is the first haddock comment of a duplicate record field.
+ }
+
+data DupeFields2 =
+ DF2 { dupeField :: Int -- ^ This is the second haddock comment of a duplicate record field.
+ }
+
+data DupeFields3 =
+ DF3 { dupeField :: Int -- No haddock
+ }
+
-- | This is the haddock comment of a function declaration for func1.
func1 :: Int -> Int -> Int
func1 x y = x + y
diff --git a/testsuite/tests/ghci/scripts/ghci065.script b/testsuite/tests/ghci/scripts/ghci065.script
index 7f05945576..12d03b1d91 100644
--- a/testsuite/tests/ghci/scripts/ghci065.script
+++ b/testsuite/tests/ghci/scripts/ghci065.script
@@ -7,6 +7,7 @@
:doc Val2b
:doc Data3
:doc Data4
+:doc dupeField
:doc func1
:doc func2
diff --git a/testsuite/tests/ghci/scripts/ghci065.stdout b/testsuite/tests/ghci/scripts/ghci065.stdout
index b14f3f503a..2ea0831856 100644
--- a/testsuite/tests/ghci/scripts/ghci065.stdout
+++ b/testsuite/tests/ghci/scripts/ghci065.stdout
@@ -3,6 +3,9 @@
This is the haddock comment of a data value for Val2b
This is the haddock comment of a data declaration for Data3.
This is the haddock comment of a data constructor for Data4.
+ This is the second haddock comment of a duplicate record field.
+
+ This is the first haddock comment of a duplicate record field.
This is the haddock comment of a function declaration for func1.
<has no documentation>
This is the haddock comment of a function declaration for func3.