[svn:parrot] r47741 - trunk/t/pmc
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Mon Jun 21 17:18:55 UTC 2010
Author: NotFound
Date: Mon Jun 21 17:18:55 2010
New Revision: 47741
URL: https://trac.parrot.org/parrot/changeset/47741
Log:
some more HashIterator tests
Modified:
trunk/t/pmc/hashiterator.t
Modified: trunk/t/pmc/hashiterator.t
==============================================================================
--- trunk/t/pmc/hashiterator.t Mon Jun 21 16:30:42 2010 (r47740)
+++ trunk/t/pmc/hashiterator.t Mon Jun 21 17:18:55 2010 (r47741)
@@ -18,16 +18,17 @@
=cut
+.include 'except_types.pasm'
+
.sub main :main
.include 'test_more.pir'
- .include 'except_types.pasm'
- plan(6)
+ plan(8)
iter_over_empty_hash()
iter_over_single_element()
iter_over_single_element_with_checks()
-
+ iter_invalid_type()
.end
.sub 'iter_over_empty_hash'
@@ -36,6 +37,21 @@
it = new 'HashIterator', hash
$I0 = isfalse it
ok($I0, "Iterator for empty Hash is empty")
+ .local pmc eh
+ .local int i
+ i = 1
+ eh = new 'ExceptionHandler'
+ eh.'handle_types'(.EXCEPTION_OUT_OF_BOUNDS)
+ set_addr eh, catch
+ push_eh catch
+ $P0 = shift it
+ i = 0
+ goto report
+ catch:
+ finalize eh
+ report:
+ pop_eh
+ ok(i, 'shift for empty hash throws')
.end
.sub 'iter_over_single_element'
@@ -67,6 +83,27 @@
.end
+.sub 'iter_invalid_type'
+ .local pmc hash, it
+ hash = new 'Hash'
+ it = new 'HashIterator', hash
+ .local pmc eh
+ .local int i
+ i = 1
+ eh = new 'ExceptionHandler'
+ eh.'handle_types'(.EXCEPTION_INVALID_OPERATION)
+ set_addr eh, catch
+ push_eh catch
+ it = 987 # Arbitrary value, let's hope we never use
+ i = 0
+ goto report
+ catch:
+ finalize eh
+ report:
+ pop_eh
+ ok(i, 'setting invalid type throws')
+.end
+
# Local Variables:
# mode: pir
# fill-column: 100
More information about the parrot-commits
mailing list