Remove clean_cmd and extra_clean usage from .T files
[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', [], compile_and_run, [''])
13 test('hClose002', [], compile_and_run, [''])
14 test('hClose003',       reqlib('unix'), compile_and_run, ['-package unix'])
15 test('hFileSize001',    normal, compile_and_run, [''])
16 test('hFileSize002', [omit_ways(['ghci'])], compile_and_run, [''])
17 test('hFlush001', [], compile_and_run, [''])
18
19 test('hGetBuffering001', 
20         [omit_ways(['ghci']), set_stdin('hGetBuffering001.hs')], 
21         compile_and_run, [''])
22
23 test('hGetChar001', normal, compile_and_run, [''])
24 test('hGetLine001', set_stdin('hGetLine001.hs'), compile_and_run, ['-cpp'])
25 test('hGetLine002', normal, compile_and_run, [''])
26 test('hGetLine003', normal, compile_and_run, [''])
27 test('hGetPosn001', [], compile_and_run, ['-cpp'])
28 test('hIsEOF001',   normal, compile_and_run, [''])
29 test('hIsEOF002', [], compile_and_run, ['-cpp'])
30
31 test('hReady001', normal, compile_and_run, ['-cpp'])
32
33 # hReady002 tests that hReady returns False for a pipe that has no
34 # data to read.  It relies on piping input from 'sleep 1', which doesn't
35 # work for the 'ghci' way because in that case we already pipe input from
36 # a script, so hence omit_ways(['ghci'])
37 test('hReady002', [cmd_prefix('sleep 1 |'), omit_ways(['ghci'])],
38      compile_and_run, [''])
39
40 test('hSeek001', normal, compile_and_run, [''])
41 test('hSeek002', normal, compile_and_run, ['-cpp'])
42 test('hSeek003', normal, compile_and_run, ['-cpp'])
43 test('hSeek004', [], compile_and_run, ['-cpp'])
44
45 test('hSetBuffering002', set_stdin('hSetBuffering002.hs'), compile_and_run, [''])
46
47 test('hSetBuffering003',
48     [omit_ways(['ghci']), set_stdin('hSetBuffering003.hs')], 
49         compile_and_run, [''])
50
51 test('hSetBuffering004', set_stdin('hSetBuffering004.hs'), compile_and_run, [''])
52
53 test('ioeGetErrorString001', normal, compile_and_run, ['-cpp'])
54 test('ioeGetFileName001',    normal, compile_and_run, ['-cpp'])
55 test('ioeGetHandle001',      normal, compile_and_run, ['-cpp'])
56 test('isEOF001', extra_run_opts('</dev/null'), compile_and_run, [''])
57
58 test('misc001', [extra_run_opts('misc001.hs misc001.out')], compile_and_run,
59      [''])
60
61 test('openFile001',  normal, compile_and_run, [''])
62 test('openFile002',  exit_code(1), compile_and_run, [''])
63 test('openFile003', [], compile_and_run, [''])
64 test('openFile004', [], compile_and_run, [''])
65 test('openFile005', [], compile_and_run, [''])
66 test('openFile006', [], compile_and_run, [''])
67 test('openFile007', [], compile_and_run, [''])
68 test('openFile008', cmd_prefix('ulimit -n 2048; '), compile_and_run, [''])
69
70 test('putStr001',    normal, compile_and_run, [''])
71 test('readFile001', [], compile_and_run, [''])
72 test('readwrite001', [], compile_and_run, ['-cpp'])
73
74
75 test('readwrite002', [omit_ways(['ghci']), set_stdin('readwrite002.hs')],
76      compile_and_run, ['-cpp'])
77
78 test('readwrite003', [], compile_and_run, [''])
79
80 test('hGetBuf001',
81      [
82       when(fast(), skip),
83       expect_fail_if_windows],
84      compile_and_run, ['-package unix'])
85
86 test('hDuplicateTo001', [], compile_and_run, [''])
87
88 test('countReaders001', [], compile_and_run, [''])
89
90 test('concio001', normal, run_command, ['$MAKE -s --no-print-directory test.concio001'])
91 test('concio001.thr', normal, run_command, ['$MAKE -s --no-print-directory test.concio001.thr'])
92
93 test('concio002', reqlib('process'), compile_and_run, [''])
94
95 test('T2122', [], compile_and_run, [''])
96 test('T3307', [], run_command, ['$MAKE -s --no-print-directory T3307-test'])
97 test('T4855', normal, compile_and_run, [''])
98
99 test('hSetEncoding001',extra_run_opts('hSetEncoding001.in'), compile_and_run, [''])
100 test('decodingerror001',normal, compile_and_run, [''])
101 test('decodingerror002',normal, compile_and_run, [''])
102
103 encoding001Encodings = ["utf8", "utf8_bom", "utf16", "utf16le",
104                         "utf16be", "utf32", "utf32le", "utf32be"]
105 encoding001CleanFiles = []
106 for e in encoding001Encodings:
107     encoding001CleanFiles.append('encoding001.' + e)
108 for e1 in encoding001Encodings:
109     for e2 in encoding001Encodings:
110         encoding001CleanFiles.append('encoding001.' + e1 + '.' + e2)
111 test('encoding001', [], compile_and_run, [''])
112
113 test('encoding002', normal, compile_and_run, [''])
114 test('encoding003', normal, compile_and_run, [''])
115 test('encoding004', normal, compile_and_run, [''])
116 test('encoding005', normal, compile_and_run, [''])
117
118 test('environment001', [], run_command,
119      ['$MAKE -s --no-print-directory environment001-test'])
120
121 test('newline001', [], compile_and_run, [''])
122
123 test('openTempFile001', normal, compile_and_run, [''])
124
125 test('T4144', normal, compile_and_run, [''])
126
127 test('encodingerror001', normal, compile_and_run, [''])
128
129 test('T4808', [exit_code(1)], compile_and_run, [''])
130 test('T4895', normal, compile_and_run, [''])
131 test('T7853', normal, compile_and_run, [''])