Index: ext/Parrot-Embed/t/interp.t =================================================================== --- ext/Parrot-Embed/t/interp.t (revision 48740) +++ ext/Parrot-Embed/t/interp.t (working copy) @@ -6,7 +6,7 @@ use strict; use warnings; -use Test::More tests => 23; +use Test::More tests => 28; use File::Spec; my $hello_pbc = File::Spec->catfile( 't', 'greet.pbc' ); @@ -46,6 +46,7 @@ can_ok( $global_greet, 'invoke' ); my $pmc = $global_greet->invoke( 'S->P', 'Bob' ); +isa_ok( $pmc, 'Parrot::PMC' ); ok( $pmc, 'invoke() should return a PMC, given that signature' ); is( $pmc->get_string(), 'Hello, Bob!', '... containing a string returned in the PMC' ); @@ -101,6 +102,34 @@ '... even if interpreter object has gone out of scope' ); +{ + my $add = $interp->compile( <<'END_CODE' ); +.sub my_add + .param string a + .param string b + + .return( a ) +.end +END_CODE + + ok( $add, 'compile() should compile PIR code and return a PMC' ); + isa_ok( $add, 'Parrot::PMC' ); + my $pmc_add; + eval { + $pmc_add = $add->invoke( 'PS', 23, 19 ); + }; + #Usage: Parrot::PMC::invoke(pmc, signature, argument) + TODO: { + local $TODO = 'invoke() can only get 2 parameters'; + isa_ok( $pmc_add, 'Parrot::PMC' ); + } + SKIP: { + skip "Previous TODO returns undef", 1; + is($pmc_add->get_string(), 42, 'two param call works well'); + } +} + + # Local Variables: # mode: cperl # cperl-indent-level: 4