From 16514f272fb42af6e9c7674a9bd6c9dce369231f Mon Sep 17 00:00:00 2001 From: David Terei Date: Wed, 20 Jul 2011 11:09:03 -0700 Subject: Move tests from tests/ghc-regress/* to just tests/* --- testsuite/tests/quasiquotation/qq007/Makefile | 3 +++ testsuite/tests/quasiquotation/qq007/QQ.hs | 11 +++++++++++ testsuite/tests/quasiquotation/qq007/Test.hs | 13 +++++++++++++ testsuite/tests/quasiquotation/qq007/test.T | 10 ++++++++++ 4 files changed, 37 insertions(+) create mode 100644 testsuite/tests/quasiquotation/qq007/Makefile create mode 100644 testsuite/tests/quasiquotation/qq007/QQ.hs create mode 100644 testsuite/tests/quasiquotation/qq007/Test.hs create mode 100644 testsuite/tests/quasiquotation/qq007/test.T (limited to 'testsuite/tests/quasiquotation/qq007') 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']) -- cgit v1.2.1