[svn:parrot] r44601 - branches/tt1477/ext/Parrot-Embed/t
plobsing at svn.parrot.org
plobsing at svn.parrot.org
Wed Mar 3 02:56:03 UTC 2010
Author: plobsing
Date: Wed Mar 3 02:56:02 2010
New Revision: 44601
URL: https://trac.parrot.org/parrot/changeset/44601
Log:
add test for alternate signature ("III->I")
Modified:
branches/tt1477/ext/Parrot-Embed/t/greet.pir
branches/tt1477/ext/Parrot-Embed/t/interp.t
Modified: branches/tt1477/ext/Parrot-Embed/t/greet.pir
==============================================================================
--- branches/tt1477/ext/Parrot-Embed/t/greet.pir Wed Mar 3 02:36:34 2010 (r44600)
+++ branches/tt1477/ext/Parrot-Embed/t/greet.pir Wed Mar 3 02:56:02 2010 (r44601)
@@ -2,24 +2,40 @@
# $Id$
.sub greet
- .param pmc name
+ .param pmc name
- .local string name_str
- name_str = name
+ .local string name_str
+ name_str = name
- .local pmc greeting
- greeting = new 'String'
- greeting = 'Hello, '
- greeting .= name_str
- greeting .= '!'
+ .local pmc greeting
+ greeting = new 'String'
+ greeting = 'Hello, '
+ greeting .= name_str
+ greeting .= '!'
- .return( greeting )
+ .return( greeting )
+.end
+
+.sub sum
+ .param pmc nums :slurpy
+
+ .local int acc
+ acc = 0
+
+ loop:
+ unless nums goto end_loop
+ $I0 = shift nums
+ acc += $I0
+ goto loop
+ end_loop:
+
+ .return (acc)
.end
.namespace [ 'Elsewhere' ]
.sub greet
- .return( 'Hiya!' )
+ .return( 'Hiya!' )
.end
# Local Variables:
Modified: branches/tt1477/ext/Parrot-Embed/t/interp.t
==============================================================================
--- branches/tt1477/ext/Parrot-Embed/t/interp.t Wed Mar 3 02:36:34 2010 (r44600)
+++ branches/tt1477/ext/Parrot-Embed/t/interp.t Wed Mar 3 02:56:02 2010 (r44601)
@@ -6,7 +6,7 @@
use strict;
use warnings;
-use Test::More tests => 26;
+use Test::More tests => 27;
use File::Spec;
my $hello_pbc = File::Spec->catfile( 't', 'greet.pbc' );
@@ -50,6 +50,10 @@
is( $pmc->get_string(), 'Hello, Bob!', '... containing a string returned in the PMC' );
+my $global_sum = $interp->find_global( 'sum' );
+my $sum = $global_sum->invoke('III->I', 11, 33, 55);
+is( $sum, 99, 'invoke() should handle IntVals' );
+
can_ok( $module, 'compile' );
my $eval = $interp->compile( <<END_PIR );
.sub foo
More information about the parrot-commits
mailing list