Commit 5db5edb1 by simonmar

### [project @ 2003-07-23 11:40:31 by simonmar]

`Copy some GHCi tests over from fptools/ghc/tests/ghci`
parent 6c2bb842
 module Main where import B main = print ("hello world" ++ show (f 42))
 module B (module B, module C) where import C k x = x `mod` 11
 module C (f, g, h) where import D g x = f x + 1 h x = x `div` 2 data C = C {x :: Int}
 module D where data T = A Int | B Float deriving Eq f x = x + x
 module D where data T = A Int | B Float deriving Eq f x = x + x
 module D where data T = A Int | B Float deriving Eq f x = x + 1
 TOP=../../../.. include \$(TOP)/mk/boilerplate.mk include \$(TOP)/mk/test.mk
 test('prog001', normal, ghci_script, ['prog001.script'])
 Compiling D ( D.hs, interpreted ) Compiling C ( C.hs, interpreted ) Compiling B ( B.hs, interpreted ) Compiling Main ( A.hs, interpreted ) Compiling C ( C.hs, interpreted ) Skipping B ( B.hs, interpreted ) Skipping Main ( A.hs, interpreted ) Compiling D ( D.hs, interpreted ) Skipping C ( C.hs, interpreted ) Skipping B ( B.hs, interpreted ) Skipping Main ( A.hs, interpreted ) Skipping D ( D.hs, D.o ) Compiling C ( C.hs, interpreted ) Compiling B ( B.hs, interpreted ) Compiling Main ( A.hs, interpreted )
 "hello world84" "hello world84" "hello world84" 44
 module A where data T = A Int | B Float deriving Eq f :: Int -> Int f x = x + 3
 module A where data T = A Int | B Float deriving Eq f :: Double -> Double f x = x + x
 module A where data T = A Int | B Float deriving Eq f :: Int -> Int f x = x + 3
 module B (f, g, h) where import A g x = f x + 1 h x = x `div` 2
 module C (module B, module C) where import B k x = x `mod` 11
 module Main where import C main = print ("hello world" ++ show (f 42))
 TOP=../../../.. include \$(TOP)/mk/boilerplate.mk include \$(TOP)/mk/test.mk
 test('prog002', normal, ghci_script, ['prog002.script'])
 :unset +s :unset +t -- first, clean up: :! rm -f *.hi *.o *~ :! cp A1.hs A.hs :load D -- compile A & reload :! \$HC \$HC_OPTS -no-recomp -c A.hs :reload B.g 42 B.g 42 B.g 42 -- swap A2 for A, compile & reload :! cp A2.hs A.hs :! \$HC \$HC_OPTS -no-recomp -c A.hs :reload -- the system should ignore the compiled version and compile its own. B.g 42 B.g 42 B.g 42 -- pick up newly compiled A :load D B.g 42 B.g 42 B.g 42 -- remove A.o: system should recompile A :! rm A.o :reload B.g 42 B.g 42 B.g 42
 85 85 85 46 46 46 46 46 46 46 46 46
 module Main(main,a) where import B import C(c) main = print (a 42) a x = b x + c x
 module B where import D b x = d x
 module C where import D c x = d x
 module D where -- data types and an instance data D a = A Int | B Float deriving Eq newtype N a = N Double type T a = (Int,Double) -- a class class C a where c :: a -> Int -- a function d :: Float -> Float d x = x / 3
 module D where -- data types and an instance data D a = A Int | B Float deriving Eq newtype N a = N Double type T a = (Int,Double) -- a class class C a where c :: a -> Int -- a function d :: Int -> Int d x = x * 2
 module D where -- data types and an instance data D a = A Int | B Float deriving Eq newtype N a = N Double type T a = (Int,Double) -- a class class C a where c :: a -> Int -- a function d :: Float -> Float d x = x / 3
 TOP=../../../.. include \$(TOP)/mk/boilerplate.mk include \$(TOP)/mk/test.mk
 test('prog003', normal, ghci_script, ['prog003.script'])