cvsuser 05/01/02 18:32:23
Modified: t/op lexicals.t
Log:
Various lexical tests -- mainly exceptional conditions
Revision Changes Path
1.9 +56 -2 parrot/t/op/lexicals.t
Index: lexicals.t
===================================================================
RCS file: /cvs/public/parrot/t/op/lexicals.t,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- lexicals.t 1 Oct 2004 21:16:49 -0000 1.8
+++ lexicals.t 3 Jan 2005 02:32:23 -0000 1.9
@@ -1,6 +1,6 @@
#! perl -w
# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-# $Id: lexicals.t,v 1.8 2004/10/01 21:16:49 jrieks Exp $
+# $Id: lexicals.t,v 1.9 2005/01/03 02:32:23 scog Exp $
=head1 NAME
@@ -16,7 +16,7 @@
=cut
-use Parrot::Test tests => 7;
+use Parrot::Test tests => 12;
output_is(<<CODE, <<OUTPUT, "simple store and fetch");
new_pad 0
@@ -349,5 +349,59 @@
ok 2
ok 3
OUTPUT
+
+output_like(<<'CODE', <<OUTPUT, "accessing non-existent pad, +ve index");
+ new_pad 0
+ new P0, .Integer
+ store_lex 2, "foo", P0
+ end
+CODE
+/Pad index out of range/
+OUTPUT
+
+output_like(<<'CODE', <<OUTPUT, "accessing non-existent pad, -ve index");
+ new_pad 0
+ new P0, .Integer
+ store_lex -2, "foo", P0
+ end
+CODE
+/Pad index out of range/
+OUTPUT
+
+output_is(<<'CODE', <<OUTPUT, "store with unspecified pad");
+ new_pad 0
+ new P0, .Integer
+ set P0, 10
+ store_lex 0, "abc", P0
+ new P1, .Integer
+ set P1, 20
+ store_lex "abc", P1
+ new P2, .Integer
+ find_lex P2, "abc"
+ print P2
+ print "\n"
+ end
+CODE
+20
+OUTPUT
+
+output_like(<<'CODE', <<OUTPUT, "invalid store with unspecified pad");
+ new_pad 0
+ new P0, .Integer
+ store_lex "abc", P0
+ end
+CODE
+/Lexical 'abc' not found/
+OUTPUT
+
+output_like(<<'CODE', <<'OUTPUT', "Fetch invalid var. from specific pad");
+ new_pad 0
+ new P0, .Integer
+ find_lex P0, 0, "Wibble"
+ end
+CODE
+/Lexical 'Wibble' not found/
+OUTPUT
+
1;