[svn:parrot] r45107 - branches/pcc_hackathon_6Mar10/t/pmc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Mon Mar 22 20:14:37 UTC 2010


Author: chromatic
Date: Mon Mar 22 20:14:30 2010
New Revision: 45107
URL: https://trac.parrot.org/parrot/changeset/45107

Log:
[t] Added tests for CallContext's unshift_pmc VTABLE.

Modified:
   branches/pcc_hackathon_6Mar10/t/pmc/callcontext.t

Modified: branches/pcc_hackathon_6Mar10/t/pmc/callcontext.t
==============================================================================
--- branches/pcc_hackathon_6Mar10/t/pmc/callcontext.t	Mon Mar 22 18:36:44 2010	(r45106)
+++ branches/pcc_hackathon_6Mar10/t/pmc/callcontext.t	Mon Mar 22 20:14:30 2010	(r45107)
@@ -1,5 +1,5 @@
 #! parrot
-# Copyright (C) 2006-2009, Parrot Foundation.
+# Copyright (C) 2006-2010, Parrot Foundation.
 # $Id$
 
 =head1 NAME
@@ -19,13 +19,14 @@
 .sub 'main' :main
     .include 'test_more.pir'
 
-    plan(37)
+    plan(42)
 
     test_instantiate()
     test_get_set_attrs()
     test_indexed_access()
     test_indexed_boxing()
     test_keyed_access()
+    test_shift_access()
     test_exists()
     test_clone()
 .end
@@ -195,6 +196,35 @@
     is($N2, 3.14159, 'clone - named number cloned')
 .end
 
+.sub 'test_shift_access'
+    $P0 = new ['CallContext']
+    $P1 = new [ 'String' ]
+    $P1 = 'derF'
+
+    unshift $P0, $P1
+
+    $S1 = shift $P0
+    is($S1, 'derF', 'shift should convert to proper type (PMC -> STRING)')
+
+    unshift $P0, $P1
+    $P2 = shift $P0
+
+    is($P2, 'derF', '... but not convert when unneccesary')
+    $I0 = issame $P1, $P2
+    ok($I0, '... returning the same item' )
+
+    # no unshift_string for now
+    $P0[0] = 'Fred'
+
+    $P2 = shift $P0
+    is($P2, 'Fred', 'shift should convert to proper type (STRING -> PMC)')
+
+    $P0[0] = 'Fred'
+    $S2 = shift $P0
+
+    is($S2, 'Fred', '... but not convert when unnecessary')
+.end
+
 # Local Variables:
 #   mode: pir
 #   fill-column: 100


More information about the parrot-commits mailing list