dba0e5e3d72713ddca47237ed297d7cc1a582fb1
[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                    multi_cpu_race],
39      compile_and_run, [''])
40
41 test('hSeek001', normal, compile_and_run, [''])
42 test('hSeek002', normal, compile_and_run, ['-cpp'])
43 test('hSeek003', normal, compile_and_run, ['-cpp'])
44 test('hSeek004', [], compile_and_run, ['-cpp'])
45
46 test('hSetBuffering002', set_stdin('hSetBuffering002.hs'), compile_and_run, [''])
47
48 test('hSetBuffering003',
49     [omit_ways(['ghci']), set_stdin('hSetBuffering003.hs')], 
50         compile_and_run, [''])
51
52 test('hSetBuffering004', set_stdin('hSetBuffering004.hs'), compile_and_run, [''])
53
54 test('ioeGetErrorString001', normal, compile_and_run, ['-cpp'])
55 test('ioeGetFileName001',    normal, compile_and_run, ['-cpp'])
56 test('ioeGetHandle001',      normal, compile_and_run, ['-cpp'])
57 test('isEOF001', extra_run_opts('</dev/null'), compile_and_run, [''])
58
59 test('misc001', [extra_run_opts('misc001.hs misc001.out')], compile_and_run,
60      [''])
61
62 test('openFile001',  normal, compile_and_run, [''])
63 test('openFile002',  exit_code(1), compile_and_run, [''])
64 test('openFile003', [], compile_and_run, [''])
65 test('openFile004', [], compile_and_run, [''])
66 test('openFile005', [], compile_and_run, [''])
67 test('openFile006', [], compile_and_run, [''])
68 test('openFile007', [], compile_and_run, [''])
69 test('openFile008', cmd_prefix('ulimit -n 2048; '), compile_and_run, [''])
70
71 test('putStr001',    normal, compile_and_run, [''])
72 test('readFile001', [], compile_and_run, [''])
73 test('readwrite001', [], compile_and_run, ['-cpp'])
74
75
76 test('readwrite002', [omit_ways(['ghci']), set_stdin('readwrite002.hs')],
77      compile_and_run, ['-cpp'])
78
79 test('readwrite003', [], compile_and_run, [''])
80
81 test('hGetBuf001',
82      [
83       when(fast(), skip),
84       expect_fail_if_windows],
85      compile_and_run, ['-package unix'])
86
87 test('hDuplicateTo001', [], compile_and_run, [''])
88
89 test('countReaders001', [], compile_and_run, [''])
90
91 test('concio001', [normal, multi_cpu_race],
92      run_command, ['$MAKE -s --no-print-directory test.concio001'])
93 test('concio001.thr', [extra_files(['concio001.hs']), multi_cpu_race],
94      run_command, ['$MAKE -s --no-print-directory test.concio001.thr'])
95
96 test('concio002', reqlib('process'), compile_and_run, [''])
97
98 test('T2122', [], compile_and_run, [''])
99 test('T3307', [], run_command, ['$MAKE -s --no-print-directory T3307-test'])
100 test('T4855', normal, compile_and_run, [''])
101
102 test('hSetEncoding001',extra_run_opts('hSetEncoding001.in'), compile_and_run, [''])
103 test('decodingerror001',normal, compile_and_run, [''])
104 test('decodingerror002',normal, compile_and_run, [''])
105
106 encoding001Encodings = ["utf8", "utf8_bom", "utf16", "utf16le",
107                         "utf16be", "utf32", "utf32le", "utf32be"]
108 encoding001CleanFiles = []
109 for e in encoding001Encodings:
110     encoding001CleanFiles.append('encoding001.' + e)
111 for e1 in encoding001Encodings:
112     for e2 in encoding001Encodings:
113         encoding001CleanFiles.append('encoding001.' + e1 + '.' + e2)
114 test('encoding001', [], compile_and_run, [''])
115
116 test('encoding002', normal, compile_and_run, [''])
117 test('encoding003', normal, compile_and_run, [''])
118 test('encoding004', extra_files(['encoded-data/']), compile_and_run, [''])
119 test('encoding005', normal, compile_and_run, [''])
120
121 test('environment001', [], run_command,
122      ['$MAKE -s --no-print-directory environment001-test'])
123
124 test('newline001', [], compile_and_run, [''])
125
126 test('openTempFile001', normal, compile_and_run, [''])
127
128 test('T4144', normal, compile_and_run, [''])
129
130 test('encodingerror001', normal, compile_and_run, [''])
131
132 test('T4808', [exit_code(1)], compile_and_run, [''])
133 test('T4895', normal, compile_and_run, [''])
134 test('T7853', normal, compile_and_run, [''])