summaryrefslogtreecommitdiff
path: root/testsuite/tests/quasiquotation
diff options
context:
space:
mode:
authorGeoffrey Mainland <gmainlan@microsoft.com>2011-09-30 16:25:02 +0100
committerGeoffrey Mainland <gmainlan@microsoft.com>2011-11-09 17:32:46 +0000
commit6d5e17f152d77f1593e068504603634323ae2529 (patch)
treede6ff3678155130261c91e9311c487d9f0c8a2f8 /testsuite/tests/quasiquotation
parentd704d6c8b80e61f6bdb4810177cd205732e40f71 (diff)
downloadhaskell-6d5e17f152d77f1593e068504603634323ae2529.tar.gz
Add test case T4491 for #4491.
Diffstat (limited to 'testsuite/tests/quasiquotation')
-rwxr-xr-xtestsuite/tests/quasiquotation/T4491/A.hs9
-rw-r--r--testsuite/tests/quasiquotation/T4491/Makefile3
-rw-r--r--testsuite/tests/quasiquotation/T4491/T4491.hs30
-rw-r--r--testsuite/tests/quasiquotation/T4491/T4491.stdout5
-rw-r--r--testsuite/tests/quasiquotation/T4491/test.T2
5 files changed, 49 insertions, 0 deletions
diff --git a/testsuite/tests/quasiquotation/T4491/A.hs b/testsuite/tests/quasiquotation/T4491/A.hs
new file mode 100755
index 0000000000..8c562d7221
--- /dev/null
+++ b/testsuite/tests/quasiquotation/T4491/A.hs
@@ -0,0 +1,9 @@
+{-# LANGUAGE DeriveDataTypeable #-}
+
+module A where
+
+import Data.Data
+import Data.Typeable
+
+data Foo = Foo Int
+ deriving (Show, Data, Typeable)
diff --git a/testsuite/tests/quasiquotation/T4491/Makefile b/testsuite/tests/quasiquotation/T4491/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/quasiquotation/T4491/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/quasiquotation/T4491/T4491.hs b/testsuite/tests/quasiquotation/T4491/T4491.hs
new file mode 100644
index 0000000000..3e5dd7f476
--- /dev/null
+++ b/testsuite/tests/quasiquotation/T4491/T4491.hs
@@ -0,0 +1,30 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+module Main where
+
+import Language.Haskell.TH.Quote
+
+import qualified A as B
+
+test1 :: [Int]
+test1 = $(dataToExpQ (const Nothing) [1 :: Int, 2, 3])
+
+test2 :: ()
+test2 = $(dataToExpQ (const Nothing) ())
+
+test3 :: (Int, Int, Int)
+test3 = $(dataToExpQ (const Nothing) (1 :: Int, 2 :: Int, 3 :: Int))
+
+test4 :: Rational
+test4 = $(dataToExpQ (const Nothing) (5.5 :: Rational))
+
+test5 :: B.Foo
+test5 = $(dataToExpQ (const Nothing) (B.Foo 1))
+
+main :: IO ()
+main = do
+ print test1
+ print test2
+ print test3
+ print test4
+ print test5
diff --git a/testsuite/tests/quasiquotation/T4491/T4491.stdout b/testsuite/tests/quasiquotation/T4491/T4491.stdout
new file mode 100644
index 0000000000..931a6b74b6
--- /dev/null
+++ b/testsuite/tests/quasiquotation/T4491/T4491.stdout
@@ -0,0 +1,5 @@
+[1,2,3]
+()
+(1,2,3)
+11 % 2
+Foo 1
diff --git a/testsuite/tests/quasiquotation/T4491/test.T b/testsuite/tests/quasiquotation/T4491/test.T
new file mode 100644
index 0000000000..3c6a854af0
--- /dev/null
+++ b/testsuite/tests/quasiquotation/T4491/test.T
@@ -0,0 +1,2 @@
+test('T4491', [req_interp, only_compiler_types(['ghc'])],
+ compile_and_run, [''])