summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci/prog003/prog003.script
blob: 9cdf484a59c682a154831fdf8a81c0b07fb29058 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
:unset +s
:unset +t
-- A small multi-module program, with 4 modules, A, B, C, D.  B & C
-- depend on D, and A depends on B & C.
-- 
-- This test will try various combinations of compiled and interpreted
-- versions of each module, and make sure each combination behaves
-- sensibly.

:l ../shell.hs
:def shell (\s -> do shell s; return "")

-- clean up
:shell rm -f *.o *.hi
:shell cp D1.hs D.hs

putStrLn "Run 1"
:load A
:type a
a 42

putStrLn "Run 2"
-- sigh; sleep 1, because the filesystem only stores times in seconds
:shell sleep 1; cp D2.hs D.hs
:reload
:type (A.a,B.b,C.c,D.d)
a 42

putStrLn "Run 3"
-- compile D, check that :reload doesn't pick it up
:shell "$HC" $HC_OPTS -c D.hs
:reload
:type (A.a,B.b,C.c,D.d)
a 42

putStrLn "Run 4"
-- pick up the compiled D now, with :load
:load A
:type (A.a,B.b,C.c,D.d)
a 42

putStrLn "Run 5"
-- D,C compiled
:shell "$HC" $HC_OPTS -c C.hs
:load A
:type (A.a,B.b,C.c,D.d)
a 42

putStrLn "Run 6"
-- D,C,B compiled
:shell "$HC" $HC_OPTS -c B.hs
:load A
:type (A.a,B.b,C.c,D.d)
a 42

putStrLn "Run 7"
-- D,C,B,A compiled
:shell "$HC" $HC_OPTS -c A.hs
:load A
:type (A.a,B.b,C.c,D.d)
a 42

putStrLn "Run 8"
-- D,C,A compiled  (better not use A.o)
:shell rm B.o
:load A
:type (A.a,B.b,C.c,D.d)
a 42

putStrLn "Run 9"
-- D,A compiled  (better not use A.o)
:shell rm C.o
:load A
:type (A.a,B.b,C.c,D.d)
a 42

putStrLn "Run 10"
-- A compiled  (better not use A.o)
:shell rm D.o
:load A
:type (A.a,B.b,C.c,D.d)
a 42

putStrLn "Run 11"
-- A,B,C compiled (better not use A.o, B.o, C.o)
:shell "$HC" $HC_OPTS --make -v0 A
:shell rm D.o
:load A
:type (A.a,B.b,C.c,D.d)
a 42