[svn:parrot] r48724 - trunk/t/pmc
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Mon Aug 30 07:23:22 UTC 2010
Author: NotFound
Date: Mon Aug 30 07:23:21 2010
New Revision: 48724
URL: https://trac.parrot.org/parrot/changeset/48724
Log:
some more Exception tests
Modified:
trunk/t/pmc/exception.t
Modified: trunk/t/pmc/exception.t
==============================================================================
--- trunk/t/pmc/exception.t Mon Aug 30 01:07:21 2010 (r48723)
+++ trunk/t/pmc/exception.t Mon Aug 30 07:23:21 2010 (r48724)
@@ -20,10 +20,11 @@
.sub main :main
.include 'test_more.pir'
- plan(31)
+ plan(33)
test_bool()
test_int()
test_integer_keyed()
+ test_string_keyed()
test_attrs()
test_attributes()
test_push_pop_eh()
@@ -31,6 +32,7 @@
test_push_eh_throw()
test_die()
test_throw_obj()
+ test_clone()
test_throw_clone()
.end
@@ -89,6 +91,16 @@
is(value, 1, 'get invalid key throws')
.end
+.sub test_string_keyed
+ .local pmc ex, eh
+ .local string value
+ .const string TEST_VALUE = 'fubar'
+ ex = new ['Exception']
+ ex['message'] = TEST_VALUE
+ value = ex['message']
+ is(value, TEST_VALUE, 'set/get string_keyed')
+.end
+
.sub test_attrs
$P0 = new 'ExceptionHandler'
set_addr $P0, _handler
@@ -211,6 +223,20 @@
.end
# Test clone vtable function
+
+.sub test_clone
+ .local pmc ex, exclone
+ ex = new ['Exception']
+ ex['type'] = .EXCEPTION_SYNTAX_ERROR
+ exclone = clone ex
+ .local int result
+ result = iseq ex, exclone
+ is(result, 1, 'cloned Exception is equal to original')
+ exclone['type'] = .EXCEPTION_ERR_OVERFLOW
+ result = iseq ex, exclone
+ is(result, 0, 'cloned and modified Exception is not equal to original')
+.end
+
.sub test_throw_clone
.local pmc ex, exclone, eh, ehguard
.local int result
@@ -218,9 +244,6 @@
ex['type'] = .EXCEPTION_SYNTAX_ERROR
exclone = clone ex
- result = iseq ex, exclone
- is(result, 1, 'cloned Exception is equal to original')
-
ehguard = new ['ExceptionHandler']
set_label ehguard, catchall
push_eh ehguard
More information about the parrot-commits
mailing list