2 # Copyright (C) 2008, Parrot Foundation.
7 t/op/io.t - Testing io opcodes
15 Tests various io opcodes.
22 .include 'test_more.pir'
28 open_pipe_for_reading()
29 open_pipe_for_writing()
32 .sub 'open_null_filename'
33 push_eh open_null_filename_failed
36 nok(1, 'open with null filename')
39 open_null_filename_failed:
40 ok(1, 'open with null filename')
44 push_eh open_null_mode_failed
46 $P0 = open 'some_name', $S0
47 nok(1, 'open with null mode')
50 open_null_mode_failed:
51 ok(1, 'open with null mode')
54 .sub 'tt661_todo_test' :anon
55 # As of r41963, these tests need to be todo'ed at least on Win32. Add new
56 # platforms known to fail.
57 .include 'sysinfo.pasm'
58 $S0 = sysinfo .SYSINFO_PARROT_OS
59 if $S0 == 'MSWin32' goto tt661_todo
67 .include 'iglobals.pasm'
69 .sub 'open_pipe_for_reading'
74 conf = interp[.IGLOBALS_CONFIG_HASH]
77 command = conf['build_dir']
82 aux = conf['test_prog']
89 pipe = open command, 'rp'
90 unless pipe goto open_pipe_for_reading_failed
93 line = substr line, 0, 14
94 is('This is Parrot', line, 'open pipe for reading')
97 open_pipe_for_reading_failed:
98 nok(1, 'open pipe for reading')
102 .sub 'open_pipe_for_writing'
103 $I0 = tt661_todo_test()
104 if $I0 goto open_pipe_for_writing_todoed
109 conf = interp[.IGLOBALS_CONFIG_HASH]
111 .local string command
112 command = conf['build_dir']
117 .local string filename
119 filename .= 'examples/pasm/cat.pasm'
120 aux = conf['test_prog']
128 pipe = open command, 'wp'
129 unless pipe goto open_pipe_for_writing_failed
130 pipe.'puts'("ok - open pipe for writing\n")
134 open_pipe_for_writing_failed:
135 nok(1, 'open pipe for writing')
138 open_pipe_for_writing_todoed:
139 todo(0, 'Unimplemented in this platform, TT #661')
147 # vim: expandtab shiftwidth=4 ft=pir: