[svn:parrot] r41842 - branches/pcc_optimize_sig/t/pmc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Tue Oct 13 19:58:40 UTC 2009


Author: chromatic
Date: Tue Oct 13 19:58:40 2009
New Revision: 41842
URL: https://trac.parrot.org/parrot/changeset/41842

Log:
[t] Added tests for push/pop and indexed access of INSP types in CallSignature.

Modified:
   branches/pcc_optimize_sig/t/pmc/callsignature.t

Modified: branches/pcc_optimize_sig/t/pmc/callsignature.t
==============================================================================
--- branches/pcc_optimize_sig/t/pmc/callsignature.t	Tue Oct 13 19:54:04 2009	(r41841)
+++ branches/pcc_optimize_sig/t/pmc/callsignature.t	Tue Oct 13 19:58:40 2009	(r41842)
@@ -1,5 +1,5 @@
 #! parrot
-# Copyright (C) 2006-2008, Parrot Foundation.
+# Copyright (C) 2006-2009, Parrot Foundation.
 # $Id$
 
 =head1 NAME
@@ -16,22 +16,23 @@
 
 =cut
 
-.sub main :main
+.sub 'main' :main
     .include 'test_more.pir'
 
-    plan(7)
+    plan(15)
 
     test_instantiate()
     test_get_set_attrs()
+    test_push_pop_indexed_access()
 .end
 
 
-.sub test_instantiate
+.sub 'test_instantiate'
     $P0 = new ['CallSignature']
     ok(1, 'Instantiated CallSignature')
 .end
 
-.sub test_get_set_attrs
+.sub 'test_get_set_attrs'
     $P0 = new ['CallSignature']
     $P5 = new 'String'
 
@@ -54,6 +55,35 @@
     is($P5,'cheese', 'got arg_flags attribute')
 .end
 
+.sub 'test_push_pop_indexed_access'
+    $P0 = new [ 'CallSignature' ]
+    $P1 = new [ 'Integer' ]
+    $P1 = 100
+
+    push $P0, $P1
+    $P2 = $P0[0]
+    is( $P2, 100, 'push_pmc/get_pmc_keyed_int pair' )
+    $P2 = pop $P0
+    is( $P2, 100, 'push_pmc/pop_pmc pair' )
+
+    push $P0, 200
+    $I0 = $P0[0]
+    is( $I0, 200, 'push_integer/get_integer_keyed_int pair' )
+    $I0 = pop $P0
+    is( $I0, 200, 'push_integer/pop_integer pair' )
+
+    push $P0, 3.03
+    $N0 = $P0[0]
+    is( $N0, 3.03, 'push_number/get_number_keyed_int pair' )
+    $N0 = pop $P0
+    is( $N0, 3.03, 'push_number/pop_number pair' )
+
+    push $P0, 'hello'
+    $S0 = $P0[0]
+    is( $S0, 'hello', 'push_string/get_string_keyed_int pair' )
+    $S0 = pop $P0
+    is( $S0, 'hello', 'push_string/pop_string pair' )
+.end
 
 # Local Variables:
 #   mode: pir


More information about the parrot-commits mailing list