all.T 5.91 KB
Newer Older
1 2
# -*- coding: utf-8 -*-

ian@well-typed.com's avatar
ian@well-typed.com committed
3
def expect_fail_if_windows(name, opts):
4
   f = when(opsys('mingw32'), expect_fail);
ian@well-typed.com's avatar
ian@well-typed.com committed
5
   return f(normal, opts);
6

7
test('IOError001', [omit_ways(['ghci']), set_stdin('IOError001.hs')],
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
	compile_and_run, [''])

test('IOError002',      normal, compile_and_run, [''])
test('finalization001', normal, compile_and_run, [''])
test('hClose001',       extra_clean(['hClose001.tmp']), compile_and_run, [''])
test('hClose002',       extra_clean(['hClose002.tmp']), compile_and_run, [''])
test('hClose003',       reqlib('unix'), compile_and_run, ['-package unix'])
test('hFileSize001',    normal, compile_and_run, [''])
test('hFileSize002',
     [omit_ways(['ghci']),
      extra_clean(['hFileSize002.out'])],
     compile_and_run, [''])
test('hFlush001',
     extra_clean(['hFlush001.out']),
     compile_and_run, [''])

test('hGetBuffering001', 
25
	[omit_ways(['ghci']), set_stdin('hGetBuffering001.hs')], 
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
	compile_and_run, [''])

test('hGetChar001', normal, compile_and_run, [''])
test('hGetLine001', set_stdin('hGetLine001.hs'), compile_and_run, ['-cpp'])
test('hGetLine002', normal, compile_and_run, [''])
test('hGetLine003', normal, compile_and_run, [''])
test('hGetPosn001',
     extra_clean(['hGetPosn001.out']),
     compile_and_run, ['-cpp'])
test('hIsEOF001',   normal, compile_and_run, [''])
test('hIsEOF002', extra_clean(['hIsEOF002.out']), compile_and_run, ['-cpp'])

test('hReady001', normal, compile_and_run, ['-cpp'])

# hReady002 tests that hReady returns False for a pipe that has no
# data to read.  It relies on piping input from 'sleep 1', which doesn't
# work for the 'ghci' way because in that case we already pipe input from
# a script, so hence omit_ways(['ghci'])
test('hReady002', [ no_stdin, cmd_prefix('sleep 1 |'),
                    omit_ways(['ghci']) ],
                   compile_and_run, [''])

test('hSeek001', normal, compile_and_run, [''])
test('hSeek002', normal, compile_and_run, ['-cpp'])
test('hSeek003', normal, compile_and_run, ['-cpp'])
test('hSeek004', extra_clean(['hSeek004.out']), compile_and_run, ['-cpp'])

test('hSetBuffering002', set_stdin('hSetBuffering002.hs'), compile_and_run, [''])

55 56
test('hSetBuffering003',
    [omit_ways(['ghci']), set_stdin('hSetBuffering003.hs')], 
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
	compile_and_run, [''])

test('hSetBuffering004', set_stdin('hSetBuffering004.hs'), compile_and_run, [''])

test('ioeGetErrorString001', normal, compile_and_run, ['-cpp'])
test('ioeGetFileName001',    normal, compile_and_run, ['-cpp'])
test('ioeGetHandle001',      normal, compile_and_run, ['-cpp'])
test('isEOF001',     normal, compile_and_run, [''])

test('misc001',
     [extra_run_opts('misc001.hs misc001.out'),
      extra_clean(['misc001.out'])],
	compile_and_run, [''])

test('openFile001',  normal, compile_and_run, [''])
test('openFile002',  exit_code(1), compile_and_run, [''])
test('openFile003',  extra_clean(['openFile003Dir']), compile_and_run, [''])
test('openFile004',  extra_clean(['openFile004.out']), compile_and_run, [''])
75
test('openFile005',  extra_clean(['openFile005.out1', 'openFile005.out2']),
76 77
     compile_and_run, [''])
test('openFile006', extra_clean(['openFile006.out']), compile_and_run, [''])
78
test('openFile007', extra_clean(['openFile007.out']), compile_and_run, [''])
79 80 81
test('openFile008', cmd_prefix('ulimit -n 1024; '), compile_and_run, [''])

test('putStr001',    normal, compile_and_run, [''])
82
test('readFile001',  extra_clean(['readFile001.out']),
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
     compile_and_run, [''])
test('readwrite001',
     extra_clean(['readwrite001.inout']),
     compile_and_run,
     ['-cpp'])


test('readwrite002',
     [omit_ways(['ghci']), 
      set_stdin('readwrite002.hs'),
      extra_clean(['readwrite002.inout'])],
     compile_and_run, ['-cpp'])

test('readwrite003', extra_clean(['readwrite003.txt']), compile_and_run, [''])

98
test('hGetBuf001',
99
     [
100 101 102
      when(fast(), skip),
      expect_fail_if_windows],
     compile_and_run, ['-package unix'])
103 104 105 106 107 108 109 110 111 112 113 114

test('hDuplicateTo001', extra_clean(['tmp']), compile_and_run, [''])

test('countReaders001',
      extra_clean(['countReaders001.txt']),
      compile_and_run, [''])

test('concio001', skip, run_command, ['$MAKE -s --no-print-directory test.concio001'])
test('concio001.thr', skip, run_command, ['$MAKE -s --no-print-directory test.concio001.thr'])

test('concio002', reqlib('process'), compile_and_run, [''])

115 116
test('T2122', extra_clean(['T2122-test']), compile_and_run, [''])
test('T3307',
117
     [extra_clean(['chinese-file-小说', 'chinese-name'])],
118
     run_command,
119 120
     ['$MAKE -s --no-print-directory T3307-test'])
test('T4855', normal, compile_and_run, [''])
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138

test('hSetEncoding001',extra_run_opts('hSetEncoding001.in'), compile_and_run, [''])
test('decodingerror001',normal, compile_and_run, [''])
test('decodingerror002',normal, compile_and_run, [''])

encoding001Encodings = ["utf8", "utf8_bom", "utf16", "utf16le",
                        "utf16be", "utf32", "utf32le", "utf32be"]
encoding001CleanFiles = []
for e in encoding001Encodings:
    encoding001CleanFiles.append('encoding001.' + e)
for e1 in encoding001Encodings:
    for e2 in encoding001Encodings:
        encoding001CleanFiles.append('encoding001.' + e1 + '.' + e2)
test('encoding001',
     extra_clean(encoding001CleanFiles),
     compile_and_run, [''])

test('encoding002', normal, compile_and_run, [''])
batterseapower's avatar
batterseapower committed
139
test('encoding003', normal, compile_and_run, [''])
140
test('encoding004', normal, compile_and_run, [''])
141 142
test('encoding005', when(opsys('mingw32'), expect_broken(10623)),
     compile_and_run, [''])
143 144

test('environment001',
145
     [extra_clean(['environment001'])],
146 147 148 149 150 151 152 153 154 155 156
     run_command,
     ['$MAKE -s --no-print-directory environment001-test'])

test('newline001', extra_clean(['newline001.out']), compile_and_run, [''])

test('openTempFile001', normal, compile_and_run, [''])

test('T4144', normal, compile_and_run, [''])

test('encodingerror001', normal, compile_and_run, [''])

157 158
test('T4808', [exit_code(1), extra_clean(['T4808.test'])], compile_and_run, [''])
test('T4895', normal, compile_and_run, [''])
batterseapower's avatar
batterseapower committed
159
test('T7853', normal, compile_and_run, [''])