[project @ 1998-12-02 13:17:09 by simonm]
[ghc-hetmet.git] / ghc / interpreter / test / unused / print.hs
1 --!!! Testing top level printer (note that this doesn't necessarily test show)
2
3 -- Test things of type String
4
5 test1, test2, test3 :: String
6
7 test1 = "abcd"
8 test2 = ""
9 test3 = "abcd\0efgh\0"
10 test4 = "abc" ++ error "def" ++ "hij"
11 test5 = "abc" ++ [error "def"] ++ "hij"
12 test6 = 'a' : 'b' : 'c' : error "foo"
13 test7 = 'a' : 'b' : 'c' : error "foo" : []
14 test8 = show (error "foo"::String)
15
16 test11, test12 :: String
17 test11 = case (error "foo") of _ -> "abcd"
18 test12 = case (error "foo") of [] -> "abcd"
19
20 test13, test14 :: String
21 test13 = error (error "foo")
22 test14 = error test14
23
24
25
26 -- Test things of type IO ()
27
28 {- can't include this in backwards compatability tests
29
30 -- Normal
31
32 test101, test102, test103 :: IO ()
33 test101 = putStr "abcd"
34 test102 = return ()
35 test103 = putChar 'a'
36
37 -- Errors
38
39 test111, test112, test113, test114 :: IO ()
40 test111 = error "foo"
41 test112 = putStr (error "foo")
42 test113 = putStr "abcd" >> putStr (error "foo") >> putStr "efgh"
43 test114 = putStr "abcd" >> error "foo" >> putStr "efgh"
44
45 test123, test124, test125 :: IO ()
46 test123 = error (error "foo")
47 test124 = error x where x = error x
48 test125 = error x where x = 'a' : error x
49
50 -}
51
52 -- Test things of type a
53
54 -- Unit
55
56 test241, test242 :: ()
57 test241 = ()
58 test242 = error "foo"
59
60 -- Ints
61
62 test251, test252 :: Int
63 test251 = 10
64 test252 = -10
65
66 test253, test254 :: Int
67 test253 = 42 + error "foo"
68 test254 = error "foo" + 42
69
70 -- Integers
71
72 test261, test262 :: Integer
73 test261 = 10
74 test262 = 10
75
76 -- Floats
77
78 test271, test272 :: Float
79 test271 = 10
80 test272 = -10
81
82 -- Doubles
83
84 test281, test282 :: Double
85 test281 = 10
86 test282 = -10
87
88 -- Char
89
90 test291, test292, test293 :: Char
91 test291 = 'a'
92 test292 = '\0'
93 test293 = '\DEL'
94
95 -- Lists
96
97 test301, test302 :: [Int]
98 test301 = []
99 test302 = [1]
100
101 -- Bool
102
103 test311 = True
104 test312 = False
105
106 -- Tuples
107
108 test321 = ('a','b')
109 test322 = ('a','b','c')
110
111 test323 :: (Int,Int, Int)
112 test323 = (1, error "foo", 3)
113
114 -- Datatypes
115
116 data E a b = L a | R b
117 test331 = R (1::Int)
118 test332 = L 'a'
119
120 data M a = N | J a
121 test333 = J True
122 test334 = N
123
124 -- No dialogue tests in this file