Commit fce14fc8 authored by simonpj's avatar simonpj
Browse files

[project @ 2005-10-26 12:05:44 by simonpj]

Add new tests
parent d38ad948
<<<<<<< TH_genEx.stderr
Chasing modules from: TH_genEx.hs
[1 of 2] Compiling TH_genExLib ( ./TH_genExLib.hs, ./TH_genExLib.o )
[2 of 2] Compiling TH_genEx ( TH_genEx.hs, TH_genEx.o )
=======
>>>>>>> 1.2
TH_genEx.hs:1:0:
TH_genEx.hs:1:0: Splicing declarations
genAny (reify 'MyInterface)
......
{-# OPTIONS -fglasgow-exts -fth -fallow-undecidable-instances #-}
module TH_spliceDecl4 where
import TH_spliceDecl4_Lib
instance IncrSelf String where
incrSelf x = x ++ "x"
$(instanceIncrSelfTuple 2)
{-# OPTIONS -fglasgow-exts -fth -fallow-undecidable-instances #-}
module TH_spliceDecl4_Lib(
instanceIncrSelfTuple,
IncrSelf(..)
)
where
import Control.Monad
import Data.Maybe
import Language.Haskell.TH
class IncrSelf a where
incrSelf :: a -> a
instanceIncrSelfTuple :: Int -> Q [Dec]
instanceIncrSelfTuple n = [d| incrSelf value = True |]
{-# OPTIONS -fglasgow-exts #-}
module Main where
import TH_spliceE5_Lib
v1 = "foo"
main = putStrLn $(expandVars ["v1","v2"])
-- The splice expands to refer to both v1 and v2,
-- and the test checks that we don't dependency-analyse
-- the program so that one or the other isn't in scope
-- to the type checker
v2 = "bar"
{-# OPTIONS -fglasgow-exts #-}
module TH_spliceE5_Lib where
import Language.Haskell.TH
expandVars :: [String] -> Q Exp
expandVars s = [| concat $(return (ListE (map f s))) |]
where
f x = VarE (mkName x)
......@@ -16,6 +16,9 @@ test('TH_repGuard', normal, compile, [''])
test('TH_repGuardOutput', normal, compile_and_run, [''])
test('TH_repPatSig', normal, compile, [''])
test('TH_spliceE5', normal, multimod_compile_and_run, ['TH_spliceE5', '-v0'])
clean(['TH_spliceE5_Lib.hi', 'TH_spliceE5_Lib.o'])
test('TH_reifyDecl1', normal, compile, [''])
test('TH_reifyType1', normal, compile, [''])
......@@ -25,6 +28,8 @@ test('TH_spliceDecl1', normal, compile, ['-v0'])
test('TH_spliceDecl2', normal, compile, ['-v0'])
test('TH_spliceDecl3', normal, multimod_compile, ['TH_spliceDecl3', '-v0'])
clean(['TH_spliceDecl3_Lib.hi', 'TH_spliceDecl3_Lib.o'])
test('TH_spliceDecl4', normal, multimod_compile, ['TH_spliceDecl4', '-v0'])
clean(['TH_spliceDecl4_Lib.hi', 'TH_spliceDecl4_Lib.o'])
test('TH_spliceE1', normal, compile_and_run, [''])
test('TH_spliceExpr1', normal, compile, ['-v0'])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment