diff options
Diffstat (limited to 'testsuite/tests/showIface')
-rw-r--r-- | testsuite/tests/showIface/DocsInHiFile.hs | 37 | ||||
-rw-r--r-- | testsuite/tests/showIface/DocsInHiFile0.stdout | 4 | ||||
-rw-r--r-- | testsuite/tests/showIface/DocsInHiFile1.stdout | 36 | ||||
-rw-r--r-- | testsuite/tests/showIface/Makefile | 8 | ||||
-rw-r--r-- | testsuite/tests/showIface/Orphans.stdout | 12 | ||||
-rw-r--r-- | testsuite/tests/showIface/all.T | 8 |
6 files changed, 99 insertions, 6 deletions
diff --git a/testsuite/tests/showIface/DocsInHiFile.hs b/testsuite/tests/showIface/DocsInHiFile.hs new file mode 100644 index 0000000000..26156722ac --- /dev/null +++ b/testsuite/tests/showIface/DocsInHiFile.hs @@ -0,0 +1,37 @@ +{-| `elem`, 'print', +`Unknown', +'<>', ':=:', 'Bool' +-} +module DocsInHiFile + ( DocsInHiFile.elem + , D(..) + , add + , P(..) + , Show(..) + ) where + +-- | '()', 'elem'. +elem :: () +elem = () + +-- | A datatype. +data D + = D0 -- ^ A constructor for 'D'. ' + | D1 -- ^ Another constructor + deriving ( Show -- ^ 'Show' instance + ) + +add :: Int -- ^ First summand for 'add' + -> Int -- ^ Second summand + -> Int -- ^ Sum +add a b = a + b + +-- | A class +class P f where + -- | A class method + p :: a -- ^ An argument + -> f a + +-- | Another datatype... +data D' +-- ^ ...with two docstrings. diff --git a/testsuite/tests/showIface/DocsInHiFile0.stdout b/testsuite/tests/showIface/DocsInHiFile0.stdout new file mode 100644 index 0000000000..e1c32d63c8 --- /dev/null +++ b/testsuite/tests/showIface/DocsInHiFile0.stdout @@ -0,0 +1,4 @@ +module header: + Nothing +declaration docs: +arg docs: diff --git a/testsuite/tests/showIface/DocsInHiFile1.stdout b/testsuite/tests/showIface/DocsInHiFile1.stdout new file mode 100644 index 0000000000..2576c2560c --- /dev/null +++ b/testsuite/tests/showIface/DocsInHiFile1.stdout @@ -0,0 +1,36 @@ +module header: + Just " `elem`, 'print', +`Unknown', +'<>', ':=:', 'Bool' +" +declaration docs: + elem: + " '()', 'elem'." + D: + " A datatype." + D0: + " A constructor for 'D'. '" + D1: + " Another constructor" + P: + " A class" + p: + " A class method" + $fShowD: + " 'Show' instance" + D': + " Another datatype... + + ...with two docstrings." +arg docs: + add: + 0: + " First summand for 'add'" + 1: + " Second summand" + 2: + " Sum" + p: + 0: + " An argument" + diff --git a/testsuite/tests/showIface/Makefile b/testsuite/tests/showIface/Makefile index 49b90342b3..7eafdfc9d2 100644 --- a/testsuite/tests/showIface/Makefile +++ b/testsuite/tests/showIface/Makefile @@ -5,3 +5,11 @@ include $(TOP)/mk/test.mk Orphans: '$(TEST_HC)' $(TEST_HC_OPTS) -c Orphans.hs '$(TEST_HC)' $(TEST_HC_OPTS) --show-iface Orphans.hi | grep -E '^(instance |family instance |"myrule)' | grep -v 'family instance modules:' + +DocsInHiFile0: + '$(TEST_HC)' $(TEST_HC_OPTS) -c DocsInHiFile.hs + '$(TEST_HC)' $(TEST_HC_OPTS) --show-iface DocsInHiFile.hi | grep -A 4 'module header:' + +DocsInHiFile1: + '$(TEST_HC)' $(TEST_HC_OPTS) -c -haddock DocsInHiFile.hs + '$(TEST_HC)' $(TEST_HC_OPTS) --show-iface DocsInHiFile.hi | grep -A 100 'module header:' diff --git a/testsuite/tests/showIface/Orphans.stdout b/testsuite/tests/showIface/Orphans.stdout index d61a5c98f3..63fcd79a19 100644 --- a/testsuite/tests/showIface/Orphans.stdout +++ b/testsuite/tests/showIface/Orphans.stdout @@ -1,6 +1,6 @@ -instance [orphan] IsList [Bool] = $fIsListBool -instance IsList [X] = $fIsListX -family instance Item [X] = D:R:ItemX -family instance [orphan] Item [Bool] = D:R:ItemBool -"myrule1" [orphan] forall @ a id @ (a -> a) (id @ a) = id @ a -"myrule2" forall id @ (X -> X) f = f +instance [orphan] GHC.Exts.IsList [GHC.Types.Bool] = $fIsListBool +instance GHC.Exts.IsList [X] = $fIsListX +family instance GHC.Exts.Item [X] = D:R:ItemX +family instance [orphan] GHC.Exts.Item [GHC.Types.Bool] +"myrule1" [orphan] forall @ a +"myrule2" forall GHC.Base.id @ (X -> X) f = f diff --git a/testsuite/tests/showIface/all.T b/testsuite/tests/showIface/all.T index 5c89b70b59..df5d5cd9ec 100644 --- a/testsuite/tests/showIface/all.T +++ b/testsuite/tests/showIface/all.T @@ -1 +1,9 @@ test('Orphans', normal, run_command, ['$MAKE -s --no-print-directory Orphans']) +test('DocsInHiFile0', + extra_files(['DocsInHiFile.hs']), + run_command, + ['$MAKE -s --no-print-directory DocsInHiFile0']) +test('DocsInHiFile1', + extra_files(['DocsInHiFile.hs']), + run_command, + ['$MAKE -s --no-print-directory DocsInHiFile1']) |