cvsuser 02/10/16 13:21:02
Modified: t/op string.t
Log:
Patch #17903 from Simon Glover
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).
Revision Changes Path
1.38 +30 -1 parrot/t/op/string.t
Index: string.t
===================================================================
RCS file: /cvs/public/parrot/t/op/string.t,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -w -r1.37 -r1.38
--- string.t 11 Oct 2002 07:46:12 -0000 1.37
+++ string.t 16 Oct 2002 20:21:02 -0000 1.38
@@ -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" );
@@ -1498,6 +1498,35 @@
1e+06 == 1e+06
0.5 == 0.5
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)