diff options
Diffstat (limited to 'testsuite/tests/ghci/prog001')
-rw-r--r-- | testsuite/tests/ghci/prog001/A.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/ghci/prog001/B.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/ghci/prog001/C.hs | 9 | ||||
-rw-r--r-- | testsuite/tests/ghci/prog001/D1.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/ghci/prog001/D2.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/ghci/prog001/Makefile | 3 | ||||
-rw-r--r-- | testsuite/tests/ghci/prog001/prog001.T | 2 | ||||
-rw-r--r-- | testsuite/tests/ghci/prog001/prog001.script | 40 | ||||
-rw-r--r-- | testsuite/tests/ghci/prog001/prog001.stdout | 4 |
9 files changed, 78 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/prog001/A.hs b/testsuite/tests/ghci/prog001/A.hs new file mode 100644 index 0000000000..ca0a7e864b --- /dev/null +++ b/testsuite/tests/ghci/prog001/A.hs @@ -0,0 +1,5 @@ +module Main where + +import B + +main = print ("hello world" ++ show (f 42)) diff --git a/testsuite/tests/ghci/prog001/B.hs b/testsuite/tests/ghci/prog001/B.hs new file mode 100644 index 0000000000..e57c31ffff --- /dev/null +++ b/testsuite/tests/ghci/prog001/B.hs @@ -0,0 +1,5 @@ +module B (module B, module C) where + +import C + +k x = x `mod` 11 diff --git a/testsuite/tests/ghci/prog001/C.hs b/testsuite/tests/ghci/prog001/C.hs new file mode 100644 index 0000000000..006014f98c --- /dev/null +++ b/testsuite/tests/ghci/prog001/C.hs @@ -0,0 +1,9 @@ +module C (f, g, h) where + +import D + +g x = f x + 1 + +h x = x `div` 2 + +data C = C {x :: Int} diff --git a/testsuite/tests/ghci/prog001/D1.hs b/testsuite/tests/ghci/prog001/D1.hs new file mode 100644 index 0000000000..35184c7afe --- /dev/null +++ b/testsuite/tests/ghci/prog001/D1.hs @@ -0,0 +1,5 @@ +module D where + +data T = A Int | B Float deriving Eq + +f x = x + x diff --git a/testsuite/tests/ghci/prog001/D2.hs b/testsuite/tests/ghci/prog001/D2.hs new file mode 100644 index 0000000000..997171cdb6 --- /dev/null +++ b/testsuite/tests/ghci/prog001/D2.hs @@ -0,0 +1,5 @@ +module D where + +data T = A Int | B Float deriving Eq + +f x = x + 1 diff --git a/testsuite/tests/ghci/prog001/Makefile b/testsuite/tests/ghci/prog001/Makefile new file mode 100644 index 0000000000..9101fbd40a --- /dev/null +++ b/testsuite/tests/ghci/prog001/Makefile @@ -0,0 +1,3 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk diff --git a/testsuite/tests/ghci/prog001/prog001.T b/testsuite/tests/ghci/prog001/prog001.T new file mode 100644 index 0000000000..4dfdb69456 --- /dev/null +++ b/testsuite/tests/ghci/prog001/prog001.T @@ -0,0 +1,2 @@ +test('prog001', extra_clean(['D.hs']), ghci_script, ['prog001.script']) + diff --git a/testsuite/tests/ghci/prog001/prog001.script b/testsuite/tests/ghci/prog001/prog001.script new file mode 100644 index 0000000000..77fb21b9bb --- /dev/null +++ b/testsuite/tests/ghci/prog001/prog001.script @@ -0,0 +1,40 @@ +:unset +s + +:l ../shell.hs +:def shell (\s -> do shell s; return "") + +-- first, tidy up: +:shell rm -f *.hi *.o *~ +:shell cp D1.hs D.hs + +-- load the program (all interpreted) +:load A.hs + +-- reloading should do nothing +:reload + +-- make sure `main' works +main + +-- touch a module + recompile +:shell sleep 1 +:shell touch C.hs +:reload + +-- make sure `main' still works +main + +-- compile D & reload +:shell "$HC" $HC_OPTS -fforce-recomp -c D.hs +:reload +main + +-- change D, recompile & reload +:shell cp D2.hs D.hs +:shell "$HC" $HC_OPTS -fforce-recomp -c D.hs +:reload +:load A.hs + +-- make sure we're picking up the new D, via B +:module B +g 42 diff --git a/testsuite/tests/ghci/prog001/prog001.stdout b/testsuite/tests/ghci/prog001/prog001.stdout new file mode 100644 index 0000000000..eef24c2153 --- /dev/null +++ b/testsuite/tests/ghci/prog001/prog001.stdout @@ -0,0 +1,4 @@ +"hello world84" +"hello world84" +"hello world84" +44 |