diff options
Diffstat (limited to 'testsuite/tests/showIface/should_fail')
6 files changed, 38 insertions, 0 deletions
diff --git a/testsuite/tests/showIface/should_fail/THPutDocExternal.hs b/testsuite/tests/showIface/should_fail/THPutDocExternal.hs new file mode 100644 index 0000000000..f9a180af4c --- /dev/null +++ b/testsuite/tests/showIface/should_fail/THPutDocExternal.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell #-} + +module THPutDocExternal where + +import Language.Haskell.TH +import THPutDocExternalA + +putDoc (DeclDoc 'f) "Hello world" >> pure [] diff --git a/testsuite/tests/showIface/should_fail/THPutDocExternal.stderr b/testsuite/tests/showIface/should_fail/THPutDocExternal.stderr new file mode 100644 index 0000000000..3063fe9350 --- /dev/null +++ b/testsuite/tests/showIface/should_fail/THPutDocExternal.stderr @@ -0,0 +1,2 @@ +THPutDocExternal.hs:8:1: + Can't add documentation to THPutDocExternalA.f as it isn't inside the current module diff --git a/testsuite/tests/showIface/should_fail/THPutDocExternalA.hs b/testsuite/tests/showIface/should_fail/THPutDocExternalA.hs new file mode 100644 index 0000000000..694266bbe9 --- /dev/null +++ b/testsuite/tests/showIface/should_fail/THPutDocExternalA.hs @@ -0,0 +1,4 @@ +module THPutDocExternalA where + +f :: Int +f = 42 diff --git a/testsuite/tests/showIface/should_fail/THPutDocNonExistent.hs b/testsuite/tests/showIface/should_fail/THPutDocNonExistent.hs new file mode 100644 index 0000000000..d0b1d7a162 --- /dev/null +++ b/testsuite/tests/showIface/should_fail/THPutDocNonExistent.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE TemplateHaskell #-} + +module THPutDocNonExistent where + +import Language.Haskell.TH + +class A a where +data B + +do + t <- [t| A B |] + putDoc (InstDoc t) "a" + pure [] diff --git a/testsuite/tests/showIface/should_fail/THPutDocNonExistent.stderr b/testsuite/tests/showIface/should_fail/THPutDocNonExistent.stderr new file mode 100644 index 0000000000..ce3a64a1d9 --- /dev/null +++ b/testsuite/tests/showIface/should_fail/THPutDocNonExistent.stderr @@ -0,0 +1,2 @@ +THPutDocNonExistent.hs:10:1: + Couldn't find any instances of THPutDocNonExistent.A THPutDocNonExistent.B to add documentation to diff --git a/testsuite/tests/showIface/should_fail/all.T b/testsuite/tests/showIface/should_fail/all.T new file mode 100644 index 0000000000..0dd8106b81 --- /dev/null +++ b/testsuite/tests/showIface/should_fail/all.T @@ -0,0 +1,9 @@ +test('THPutDocExternal', + normal, + multimod_compile_fail, + ['THPutDocExternal', '-no-hs-main -haddock -c -v0']) + +test('THPutDocNonExistent', + normal, + multimod_compile_fail, + ['THPutDocNonExistent', '-no-hs-main -haddock -c -v0']) |