Always use native-Haskell de/encoders for ASCII and latin1
[ghc.git] / libraries / base / tests / IO / all.T
1 # -*- coding: utf-8 -*-
2
3 def expect_fail_if_windows(name, opts):
4    f = when(opsys('mingw32'), expect_fail);
5    return f(normal, opts);
6
7 test('IOError001', [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         [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',
56     [omit_ways(['ghci']), 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',  extra_clean(['openFile003Dir']), compile_and_run, [''])
74 test('openFile004',  extra_clean(['openFile004.out']), compile_and_run, [''])
75 test('openFile005',  extra_clean(['openFile005.out1', 'openFile005.out2']),
76      compile_and_run, [''])
77 test('openFile006', extra_clean(['openFile006.out']), compile_and_run, [''])
78 test('openFile007', extra_clean(['openFile007.out']), compile_and_run, [''])
79 test('openFile008', cmd_prefix('ulimit -n 1024; '), compile_and_run, [''])
80
81 test('putStr001',    normal, compile_and_run, [''])
82 test('readFile001',  extra_clean(['readFile001.out']),
83      compile_and_run, [''])
84 test('readwrite001',
85      extra_clean(['readwrite001.inout']),
86      compile_and_run,
87      ['-cpp'])
88
89
90 test('readwrite002',
91      [omit_ways(['ghci']), 
92       set_stdin('readwrite002.hs'),
93       extra_clean(['readwrite002.inout'])],
94      compile_and_run, ['-cpp'])
95
96 test('readwrite003', extra_clean(['readwrite003.txt']), compile_and_run, [''])
97
98 test('hGetBuf001',
99      [
100       when(fast(), skip),
101       expect_fail_if_windows],
102      compile_and_run, ['-package unix'])
103
104 test('hDuplicateTo001', extra_clean(['tmp']), compile_and_run, [''])
105
106 test('countReaders001',
107       extra_clean(['countReaders001.txt']),
108       compile_and_run, [''])
109
110 test('concio001', normal, run_command, ['$MAKE -s --no-print-directory test.concio001'])
111 test('concio001.thr', normal, run_command, ['$MAKE -s --no-print-directory test.concio001.thr'])
112
113 test('concio002', reqlib('process'), compile_and_run, [''])
114
115 test('T2122', extra_clean(['T2122-test']), compile_and_run, [''])
116 test('T3307',
117      [extra_clean(['chinese-file-小说', 'chinese-name'])],
118      run_command,
119      ['$MAKE -s --no-print-directory T3307-test'])
120 test('T4855', normal, compile_and_run, [''])
121
122 test('hSetEncoding001',extra_run_opts('hSetEncoding001.in'), compile_and_run, [''])
123 test('decodingerror001',normal, compile_and_run, [''])
124 test('decodingerror002',normal, compile_and_run, [''])
125
126 encoding001Encodings = ["utf8", "utf8_bom", "utf16", "utf16le",
127                         "utf16be", "utf32", "utf32le", "utf32be"]
128 encoding001CleanFiles = []
129 for e in encoding001Encodings:
130     encoding001CleanFiles.append('encoding001.' + e)
131 for e1 in encoding001Encodings:
132     for e2 in encoding001Encodings:
133         encoding001CleanFiles.append('encoding001.' + e1 + '.' + e2)
134 test('encoding001',
135      extra_clean(encoding001CleanFiles),
136      compile_and_run, [''])
137
138 test('encoding002', normal, compile_and_run, [''])
139 test('encoding003', normal, compile_and_run, [''])
140 test('encoding004', normal, compile_and_run, [''])
141 test('encoding005', normal, compile_and_run, [''])
142
143 test('environment001',
144      [extra_clean(['environment001'])],
145      run_command,
146      ['$MAKE -s --no-print-directory environment001-test'])
147
148 test('newline001', extra_clean(['newline001.out']), compile_and_run, [''])
149
150 test('openTempFile001', normal, compile_and_run, [''])
151
152 test('T4144', normal, compile_and_run, [''])
153
154 test('encodingerror001', normal, compile_and_run, [''])
155
156 test('T4808', [exit_code(1), extra_clean(['T4808.test'])], compile_and_run, [''])
157 test('T4895', normal, compile_and_run, [''])
158 test('T7853', normal, compile_and_run, [''])