# New Ticket Created by Simon Glover # Please include the string: [perl #17903] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=17903 >
Here's a brief test for the PMC, PMC, PMC form of the sprintf op; as an added bonus, it also tests two of the formats not previously tested (%b and %o). Simon --- t/op/string.t.old Sun Oct 13 19:45:44 2002 +++ t/op/string.t Sun Oct 13 20:04:21 2002 @@ -1,6 +1,6 @@ #! perl -w -use Parrot::Test tests => 96; +use Parrot::Test tests => 97; use Test::More; output_is( <<'CODE', <<OUTPUT, "set_s_s|sc" ); @@ -1500,6 +1500,35 @@ Hello, Hello, Pa! That's all, folks! OUTPUT +output_is(<<'CODE', <<OUTPUT, "other form of sprintf op"); + branch MAIN + +PRINTF: + sprintf P3, P2, P1 + print P3 + ret + +MAIN: + new P3, .PerlString + + new P2, .PerlString + set P2, "15 is %b\n" + new P1, .PerlArray + set P1[0], 15 + bsr PRINTF + + new P2, .PerlString + set P2, "128 is %o\n" + new P1, .PerlArray + set P1[0], 128 + bsr PRINTF + + end +CODE +15 is 1111 +128 is 200 +OUTPUT + # Set all string registers to values given by &$_[0](reg num) sub set_str_regs { my $code = shift;