Ticket #75: interp_test.diff
| File interp_test.diff, 1.5 KB (added by cotto, 3 years ago) |
|---|
-
ext/Parrot-Embed/t/interp.t
6 6 use strict; 7 7 use warnings; 8 8 9 use Test::More tests => 2 3;9 use Test::More tests => 28; 10 10 use File::Spec; 11 11 12 12 my $hello_pbc = File::Spec->catfile( 't', 'greet.pbc' ); … … 46 46 47 47 can_ok( $global_greet, 'invoke' ); 48 48 my $pmc = $global_greet->invoke( 'S->P', 'Bob' ); 49 isa_ok( $pmc, 'Parrot::PMC' ); 49 50 ok( $pmc, 'invoke() should return a PMC, given that signature' ); 50 51 51 52 is( $pmc->get_string(), 'Hello, Bob!', '... containing a string returned in the PMC' ); … … 101 102 '... even if interpreter object has gone out of scope' 102 103 ); 103 104 105 { 106 my $add = $interp->compile( <<'END_CODE' ); 107 .sub my_add 108 .param string a 109 .param string b 110 111 .return( a ) 112 .end 113 END_CODE 114 115 ok( $add, 'compile() should compile PIR code and return a PMC' ); 116 isa_ok( $add, 'Parrot::PMC' ); 117 my $pmc_add; 118 eval { 119 $pmc_add = $add->invoke( 'PS', 23, 19 ); 120 }; 121 #Usage: Parrot::PMC::invoke(pmc, signature, argument) 122 TODO: { 123 local $TODO = 'invoke() can only get 2 parameters'; 124 isa_ok( $pmc_add, 'Parrot::PMC' ); 125 } 126 SKIP: { 127 skip "Previous TODO returns undef", 1; 128 is($pmc_add->get_string(), 42, 'two param call works well'); 129 } 130 } 131 132 104 133 # Local Variables: 105 134 # mode: cperl 106 135 # cperl-indent-level: 4
