cvsuser 03/09/18 23:14:49
Modified: t/pmc io.t
Log:
These should not seg fault when passed a PMC of the wrong type
(such as a PerlUndef resulting from a failed file open)
Revision Changes Path
1.15 +43 -1 parrot/t/pmc/io.t
Index: io.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/io.t,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -w -r1.14 -r1.15
--- io.t 17 Sep 2003 17:34:11 -0000 1.14
+++ io.t 19 Sep 2003 06:14:49 -0000 1.15
@@ -1,6 +1,6 @@
#! perl -w
-use Parrot::Test tests => 19;
+use Parrot::Test tests => 20;
use Test::More;
output_is(<<'CODE', <<'OUTPUT', "open/close");
@@ -104,6 +104,48 @@
ok 5
ok 6
OUTPUT
+
+SKIP: {
+ skip ("read routines currently crash on bad input", 1);
+
+ unlink "no_such_file" if (-e "no_such_file");
+
+output_is(<<'CODE', <<'OUTPUT', "read on invalid fh should throw exception");
+ open P0, "no_such_file", "<"
+ unless P0, ok1
+ print "Huh: 'no_such_file' exists? - not "
+ok1:
+ print "ok 1\n"
+
+ newsub P20, .Exception_Handler, _readline_handler
+ set_eh P20
+ readline S0, P0 # Currently segfaults
+ print "not "
+_readline_handler:
+ print "ok 2\n"
+
+ newsub P20, .Exception_Handler, _read_handler
+ set_eh P20
+ read S0, P0, 1
+ print "not "
+_read_handler:
+ print "ok 3\n"
+
+ newsub P20, .Exception_Handler, _print_handler
+ set_eh P20
+ print P0, "kill me now\n"
+ print "not "
+_print_handler:
+ print "ok 4\n"
+
+ end
+CODE
+ok 1
+ok 2
+ok 3
+ok 4
+OUTPUT
+}
SKIP: {
skip ("clone not finished yet", 1);