cf557a6b96d3149f7ee403ee5af933b71199511d
[ghc.git] / testsuite / tests / lib / IO / all.T
1 # -*- coding: utf-8 -*-
2
3 def expect_fail_if_windows(opts):
4    f = if_platform('i386-unknown-mingw32', expect_fail);
5    return f(opts);
6
7 test('IOError001', compose(omit_ways(['ghci']), set_stdin('IOError001.hs')),
8         compile_and_run, [''])
9
10 test('IOError002',      normal, compile_and_run, [''])
11 test('finalization001', normal, compile_and_run, [''])
12 test('hClose001',       extra_clean(['hClose001.tmp']), compile_and_run, [''])
13 test('hClose002',       extra_clean(['hClose002.tmp']), compile_and_run, [''])
14 test('hClose003',       reqlib('unix'), compile_and_run, ['-package unix'])
15 test('hFileSize001',    normal, compile_and_run, [''])
16 test('hFileSize002',
17      [omit_ways(['ghci']),
18       extra_clean(['hFileSize002.out'])],
19      compile_and_run, [''])
20 test('hFlush001',
21      extra_clean(['hFlush001.out']),
22      compile_and_run, [''])
23
24 test('hGetBuffering001', 
25         compose(omit_ways(['ghci']), set_stdin('hGetBuffering001.hs')), 
26         compile_and_run, [''])
27
28 test('hGetChar001', normal, compile_and_run, [''])
29 test('hGetLine001', set_stdin('hGetLine001.hs'), compile_and_run, ['-cpp'])
30 test('hGetLine002', normal, compile_and_run, [''])
31 test('hGetLine003', normal, compile_and_run, [''])
32 test('hGetPosn001',
33      extra_clean(['hGetPosn001.out']),
34      compile_and_run, ['-cpp'])
35 test('hIsEOF001',   normal, compile_and_run, [''])
36 test('hIsEOF002', extra_clean(['hIsEOF002.out']), compile_and_run, ['-cpp'])
37
38 test('hReady001', normal, compile_and_run, ['-cpp'])
39
40 # hReady002 tests that hReady returns False for a pipe that has no
41 # data to read.  It relies on piping input from 'sleep 1', which doesn't
42 # work for the 'ghci' way because in that case we already pipe input from
43 # a script, so hence omit_ways(['ghci'])
44 test('hReady002', [ no_stdin, cmd_prefix('sleep 1 |'),
45                     omit_ways(['ghci']) ],
46                    compile_and_run, [''])
47
48 test('hSeek001', normal, compile_and_run, [''])
49 test('hSeek002', normal, compile_and_run, ['-cpp'])
50 test('hSeek003', normal, compile_and_run, ['-cpp'])
51 test('hSeek004', extra_clean(['hSeek004.out']), compile_and_run, ['-cpp'])
52
53 test('hSetBuffering002', set_stdin('hSetBuffering002.hs'), compile_and_run, [''])
54
55 test('hSetBuffering003', compose(omit_ways(['ghci']), 
56                                  set_stdin('hSetBuffering003.hs')), 
57         compile_and_run, [''])
58
59 test('hSetBuffering004', set_stdin('hSetBuffering004.hs'), compile_and_run, [''])
60
61 test('ioeGetErrorString001', normal, compile_and_run, ['-cpp'])
62 test('ioeGetFileName001',    normal, compile_and_run, ['-cpp'])
63 test('ioeGetHandle001',      normal, compile_and_run, ['-cpp'])
64 test('isEOF001',     normal, compile_and_run, [''])
65
66 test('misc001',
67      [extra_run_opts('misc001.hs misc001.out'),
68       extra_clean(['misc001.out'])],
69         compile_and_run, [''])
70
71 test('openFile001',  normal, compile_and_run, [''])
72 test('openFile002',  exit_code(1), compile_and_run, [''])
73 test('openFile003',  normal, compile_and_run, [''])
74 test('openFile004',  extra_clean(['openFile004.out']), compile_and_run, [''])
75 test('openFile005',
76      [if_compiler_type('hugs', expect_fail),
77       extra_clean(['openFile005.out1', 'openFile005.out2'])],
78      compile_and_run, [''])
79 test('openFile006', extra_clean(['openFile006.out']), compile_and_run, [''])
80 test('openFile007',
81      [if_compiler_type('hugs', expect_fail),
82       extra_clean(['openFile007.out'])],
83      compile_and_run, [''])
84 test('openFile008', cmd_prefix('ulimit -n 1024; '), compile_and_run, [''])
85
86 test('putStr001',    normal, compile_and_run, [''])
87 test('readFile001',
88      [if_compiler_type('hugs', expect_fail),
89       extra_clean(['readFile001.out'])],
90      compile_and_run, [''])
91 test('readwrite001',
92      extra_clean(['readwrite001.inout']),
93      compile_and_run,
94      ['-cpp'])
95
96
97 test('readwrite002',
98      [omit_ways(['ghci']), 
99       set_stdin('readwrite002.hs'),
100       extra_clean(['readwrite002.inout'])],
101      compile_and_run, ['-cpp'])
102
103 test('readwrite003', extra_clean(['readwrite003.txt']), compile_and_run, [''])
104
105 test('hGetBuf001', compose(only_compiler_types(['ghc']),
106                    compose(skip_if_fast,
107                      expect_fail_if_windows)), compile_and_run, ['-package unix'])
108
109 test('hDuplicateTo001', extra_clean(['tmp']), compile_and_run, [''])
110
111 test('countReaders001',
112       extra_clean(['countReaders001.txt']),
113       compile_and_run, [''])
114
115 test('concio001', skip, run_command, ['$MAKE -s --no-print-directory test.concio001'])
116 test('concio001.thr', skip, run_command, ['$MAKE -s --no-print-directory test.concio001.thr'])
117
118 test('concio002', reqlib('process'), compile_and_run, [''])
119
120 test('2122', extra_clean(['2122-test']), compile_and_run, [''])
121 test('3307',
122      [extra_clean(['chinese-file-小说', 'chinese-name'])],
123      run_command,
124      ['$MAKE -s --no-print-directory 3307-test'])
125 test('4855', normal, compile_and_run, [''])
126
127 test('hSetEncoding001',extra_run_opts('hSetEncoding001.in'), compile_and_run, [''])
128 test('decodingerror001',normal, compile_and_run, [''])
129
130 test('encoding001',
131      extra_clean([
132            'encoding001.utf16', 'encoding001.utf16.utf16be',
133            'encoding001.utf16.utf16le', 'encoding001.utf16.utf32',
134            'encoding001.utf16.utf32be', 'encoding001.utf16.utf32le',
135            'encoding001.utf16.utf8', 'encoding001.utf16be',
136            'encoding001.utf16be.utf16', 'encoding001.utf16be.utf16le',
137            'encoding001.utf16be.utf32', 'encoding001.utf16be.utf32be',
138            'encoding001.utf16be.utf32le', 'encoding001.utf16be.utf8',
139            'encoding001.utf16le', 'encoding001.utf16le.utf16',
140            'encoding001.utf16le.utf16be', 'encoding001.utf16le.utf32',
141            'encoding001.utf16le.utf32be', 'encoding001.utf16le.utf32le',
142            'encoding001.utf16le.utf8', 'encoding001.utf32',
143            'encoding001.utf32.utf16', 'encoding001.utf32.utf16be',
144            'encoding001.utf32.utf16le', 'encoding001.utf32.utf32be',
145            'encoding001.utf32.utf32le', 'encoding001.utf32.utf8',
146            'encoding001.utf32be', 'encoding001.utf32be.utf16',
147            'encoding001.utf32be.utf16be', 'encoding001.utf32be.utf16le',
148            'encoding001.utf32be.utf32', 'encoding001.utf32be.utf32le',
149            'encoding001.utf32be.utf8', 'encoding001.utf32le',
150            'encoding001.utf32le.utf16', 'encoding001.utf32le.utf16be',
151            'encoding001.utf32le.utf16le', 'encoding001.utf32le.utf32',
152            'encoding001.utf32le.utf32be', 'encoding001.utf32le.utf8',
153            'encoding001.utf8', 'encoding001.utf8.utf16',
154            'encoding001.utf8.utf16be', 'encoding001.utf8.utf16le',
155            'encoding001.utf8.utf32', 'encoding001.utf8.utf32be',
156            'encoding001.utf8.utf32le']), 
157      compile_and_run, [''])
158
159 test('encoding002', normal, compile_and_run, [''])
160
161 test('environment001', extra_clean(['environment001']), run_command, ['$MAKE -s --no-print-directory environment001-test'])
162
163 test('newline001', extra_clean(['newline001.out']), compile_and_run, [''])
164
165 test('openTempFile001', normal, compile_and_run, [''])
166 test('T4113', normal, compile_and_run, [''])
167
168 test('T4144', normal, compile_and_run, [''])
169
170 test('encodingerror001', normal, compile_and_run, [''])
171
172 test('4808', exit_code(1), compile_and_run, [''])
173 test('4895', normal, compile_and_run, [''])