summaryrefslogtreecommitdiff
path: root/t/op/ver.t
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-02-21 16:53:39 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-02-21 16:53:39 +0000
commitb22c7a20398f928f9697b491d180b979ff211bd6 (patch)
treea7c022e6617a2b7ee0b3de5e556bca3ccca7a397 /t/op/ver.t
parentf22444f551ba0fe71cb3979541c3e330a1c83a89 (diff)
downloadperl-b22c7a20398f928f9697b491d180b979ff211bd6.tar.gz
generalize "%v" format into a flag for any integral format type:
"%vd", "%v#o", "%*vX", etc are allowed p4raw-id: //depot/perl@5181
Diffstat (limited to 't/op/ver.t')
-rwxr-xr-xt/op/ver.t37
1 files changed, 33 insertions, 4 deletions
diff --git a/t/op/ver.t b/t/op/ver.t
index 66e8378d98..cfbf63a2d5 100755
--- a/t/op/ver.t
+++ b/t/op/ver.t
@@ -5,7 +5,7 @@ BEGIN {
unshift @INC, "../lib";
}
-print "1..6\n";
+print "1..15\n";
my $test = 1;
@@ -19,15 +19,44 @@ print "ok $test\n"; ++$test;
print "not " unless v1.20.300.4000 > 1.0203039 and v1.20.300.4000 < 1.0203041;
print "ok $test\n"; ++$test;
-print "not " unless sprintf("%v", "Perl") eq '80.101.114.108';
+print "not " unless sprintf("%vd", "Perl") eq '80.101.114.108';
print "ok $test\n"; ++$test;
-print "not " unless sprintf("%v", v1.22.333.4444) eq '1.22.333.4444';
+print "not " unless sprintf("%vd", v1.22.333.4444) eq '1.22.333.4444';
+print "ok $test\n"; ++$test;
+
+print "not " unless sprintf("%vx", "Perl") eq '50.65.72.6c';
+print "ok $test\n"; ++$test;
+
+print "not " unless sprintf("%vX", v1.22.333.4444) eq '1.16.14D.115C';
+print "ok $test\n"; ++$test;
+
+print "not " unless sprintf("%*v#o", ":", "Perl") eq '0120:0145:0162:0154';
+print "ok $test\n"; ++$test;
+
+print "not " unless sprintf("%*vb", "##", v1.22.333.4444)
+ eq '1##10110##101001101##1000101011100';
print "ok $test\n"; ++$test;
{
use bytes;
+ print "not " unless sprintf("%vd", "Perl") eq '80.101.114.108';
+ print "ok $test\n"; ++$test;
+
print "not " unless
- sprintf("%v", v1.22.333.4444) eq '1.22.197.141.225.133.156';
+ sprintf("%vd", v1.22.333.4444) eq '1.22.197.141.225.133.156';
+ print "ok $test\n"; ++$test;
+
+ print "not " unless sprintf("%vx", "Perl") eq '50.65.72.6c';
+ print "ok $test\n"; ++$test;
+
+ print "not " unless sprintf("%vX", v1.22.333.4444) eq '1.16.C5.8D.E1.85.9C';
+ print "ok $test\n"; ++$test;
+
+ print "not " unless sprintf("%*v#o", ":", "Perl") eq '0120:0145:0162:0154';
+ print "ok $test\n"; ++$test;
+
+ print "not " unless sprintf("%*vb", "##", v1.22.333.4444)
+ eq '1##10110##11000101##10001101##11100001##10000101##10011100';
print "ok $test\n"; ++$test;
}