Ticket #75: interpreter.diff
File interpreter.diff, 1.5 KB (added by szabgab, 13 years ago) |
---|
-
ext/Parrot-Embed/t/interp.t
6 6 use strict; 7 7 use warnings; 8 8 9 use Test::More tests => 26;9 use Test::More tests => 31; 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( 'PS', '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' ); … … 93 94 '... even if interpreter object has gone out of scope' 94 95 ); 95 96 97 { 98 my $add = $interp->compile( <<'END_CODE' ); 99 .sub my_add 100 .param string a 101 .param string b 102 103 .return( a ) 104 .end 105 END_CODE 106 107 ok( $add, 'compile() should compile PIR code and return a PMC' ); 108 isa_ok( $add, 'Parrot::PMC' ); 109 my $pmc_add; 110 eval { 111 $pmc_add = $add->invoke( 'PS', 23, 19 ); 112 }; 113 #Usage: Parrot::PMC::invoke(pmc, signature, argument) 114 TODO: { 115 local $TODO = 'invoke() can only get 2 parameters'; 116 isa_ok( $pmc_add, 'Parrot::PMC' ); 117 } 118 SKIP: { 119 skip "Previous TODO returns undef", 1; 120 is($pmc_add->get_string(), 42, 'two param call works well'); 121 } 122 } 123 124 96 125 # Local Variables: 97 126 # mode: cperl 98 127 # cperl-indent-level: 4