summaryrefslogtreecommitdiff
path: root/testsuite/tests/quasiquotation/qq007
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2011-07-20 11:09:03 -0700
committerDavid Terei <davidterei@gmail.com>2011-07-20 11:26:35 -0700
commit16514f272fb42af6e9c7674a9bd6c9dce369231f (patch)
treee4f332b45fe65e2a7a2451be5674f887b42bf199 /testsuite/tests/quasiquotation/qq007
parentebd422aed41048476aa61dd4c520d43becd78682 (diff)
downloadhaskell-16514f272fb42af6e9c7674a9bd6c9dce369231f.tar.gz
Move tests from tests/ghc-regress/* to just tests/*
Diffstat (limited to 'testsuite/tests/quasiquotation/qq007')
-rw-r--r--testsuite/tests/quasiquotation/qq007/Makefile3
-rw-r--r--testsuite/tests/quasiquotation/qq007/QQ.hs11
-rw-r--r--testsuite/tests/quasiquotation/qq007/Test.hs13
-rw-r--r--testsuite/tests/quasiquotation/qq007/test.T10
4 files changed, 37 insertions, 0 deletions
diff --git a/testsuite/tests/quasiquotation/qq007/Makefile b/testsuite/tests/quasiquotation/qq007/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/quasiquotation/qq007/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/quasiquotation/qq007/QQ.hs b/testsuite/tests/quasiquotation/qq007/QQ.hs
new file mode 100644
index 0000000000..3c13315a31
--- /dev/null
+++ b/testsuite/tests/quasiquotation/qq007/QQ.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE TemplateHaskell #-}
+module QQ where
+
+import Language.Haskell.TH.Quote
+import Language.Haskell.TH
+
+pq = QuasiQuoter { quoteDec = \_ -> [d| f x = x |],
+ quoteType = \_ -> [t| Int -> Int |],
+ quoteExp = \_ -> [| $(varE (mkName "x")) + 1::Int |],
+ quotePat = \_ -> [p| Just x |] }
+
diff --git a/testsuite/tests/quasiquotation/qq007/Test.hs b/testsuite/tests/quasiquotation/qq007/Test.hs
new file mode 100644
index 0000000000..42cef722d3
--- /dev/null
+++ b/testsuite/tests/quasiquotation/qq007/Test.hs
@@ -0,0 +1,13 @@
+{-# LANGUAGE QuasiQuotes #-}
+module Test where
+
+import QQ
+
+f :: [pq| foo |] -- Expands to Int -> Int
+[pq| blah |] -- Expands to f x = x
+
+h [pq| foo |] = f [pq| blah |] * 8
+ -- Expands to h (Just x) = f (x+1) * 8
+
+
+
diff --git a/testsuite/tests/quasiquotation/qq007/test.T b/testsuite/tests/quasiquotation/qq007/test.T
new file mode 100644
index 0000000000..6b7ef6dcd7
--- /dev/null
+++ b/testsuite/tests/quasiquotation/qq007/test.T
@@ -0,0 +1,10 @@
+test('qq007',
+ [skip_if_fast,
+ extra_clean(['QQ.hi', 'QQ.o', 'Test.hi', 'Test.o']),
+ # We'd need to jump through some hoops to run this test the
+ # profiling ways, due to the TH use, so for now we just
+ # omit the profiling ways
+ omit_ways(['profasm','profthreaded']),
+ only_compiler_types(['ghc'])],
+ multimod_compile,
+ ['Test', '-v0'])