Author: leo
Date: Mon Apr 11 08:40:33 2005
New Revision: 7806
Modified:
trunk/src/lexical.c
trunk/t/pmc/exception.t
trunk/t/pmc/scratchpad.t
Log:
adjust tests for rev 7805
Modified: trunk/src/lexical.c
==============================================================================
--- trunk/src/lexical.c (original)
+++ trunk/src/lexical.c Mon Apr 11 08:40:33 2005
@@ -262,6 +262,8 @@
return NULL;
ohash = scratchpad_index(interp, pad, depth);
+ if (pos >= VTABLE_elements(interp, ohash))
+ return NULL;
return VTABLE_get_pmc_keyed_int(interp, ohash, pos);
}
Modified: trunk/t/pmc/exception.t
==============================================================================
--- trunk/t/pmc/exception.t (original)
+++ trunk/t/pmc/exception.t Mon Apr 11 08:40:33 2005
@@ -447,7 +447,7 @@
/main
in coro
back in main
-Lexical 'nix' not found
+empty lexical pad
/
OUTPUT
Modified: trunk/t/pmc/scratchpad.t
==============================================================================
--- trunk/t/pmc/scratchpad.t (original)
+++ trunk/t/pmc/scratchpad.t Mon Apr 11 08:40:33 2005
@@ -16,7 +16,7 @@
=cut
-use Parrot::Test tests => 9;
+use Parrot::Test tests => 10;
output_is(<<CODE, <<OUTPUT, "direct set and get on scratchpad pmc");
new_pad P20, 0
@@ -226,7 +226,15 @@
/
OUTPUT
+output_like(<<'CODE', <<'OUTPUT', "find_lex -- non-existent pad");
+ find_lex P1, 1
+ end
+CODE
+/empty lexical pad/
+OUTPUT
+
output_like(<<'CODE', <<'OUTPUT', "find_lex -- non-existent variable #1");
+ new_pad 0
find_lex P1, 1
end
CODE
@@ -234,13 +242,15 @@
OUTPUT
output_like(<<'CODE', <<'OUTPUT', "find_lex -- non-existent variable #2");
+ new_pad 0
find_lex P1, 1, 2
end
CODE
-/Lexical #'2' not found/
+/Pad index out of range/
OUTPUT
output_like(<<'CODE', <<'OUTPUT', "find_lex -- non-existent variable #3");
+ new_pad 0
find_lex P1, 'wibble'
end
CODE
@@ -248,10 +258,11 @@
OUTPUT
output_like(<<'CODE', <<'OUTPUT', "find_lex -- non-existent variable #4");
+ new_pad 0
find_lex P1, 1, 'bibble'
end
CODE
-/Lexical 'bibble' not found/
+/Pad index out of range/
OUTPUT
1;