From: Jarkko Hietaniemi Date: Tue, 11 Jun 2002 13:55:12 +0000 (+0000) Subject: Trying to printf Perl-specific datatypes using printf X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=deec275f317b7ba568cf64f11f21be48566283ed;p=p5sagit%2Fp5-mst-13.2.git Trying to printf Perl-specific datatypes using printf (with perlio or stdio) is folly, says Hugo. p4raw-id: //depot/perl@17189 --- diff --git a/ext/XS/APItest/APItest.pm b/ext/XS/APItest/APItest.pm index 2a01152..bd8463b 100644 --- a/ext/XS/APItest/APItest.pm +++ b/ext/XS/APItest/APItest.pm @@ -12,9 +12,8 @@ use base qw/ DynaLoader Exporter /; # Do not simply export all your public functions/methods/constants. # Export everything since these functions are only used by a test script -our @EXPORT = qw( print_double print_nv print_iv print_int +our @EXPORT = qw( print_double print_int print_long print_float print_long_double have_long_double - print_uv print_long ); our $VERSION = '0.01'; diff --git a/ext/XS/APItest/APItest.xs b/ext/XS/APItest/APItest.xs index a24e7fb..085198a 100644 --- a/ext/XS/APItest/APItest.xs +++ b/ext/XS/APItest/APItest.xs @@ -35,24 +35,6 @@ print_long_double() #endif void -print_nv(val) - NV val - CODE: - printf("%5.3Vf\n",val); - -void -print_iv(val) - IV val - CODE: - printf("%Vd\n",val); - -void -print_uv(val) - UV val - CODE: - printf("%Vu\n",val); - -void print_int(val) int val CODE: diff --git a/ext/XS/APItest/t/printf.t b/ext/XS/APItest/t/printf.t index 6010b88..a17267d 100644 --- a/ext/XS/APItest/t/printf.t +++ b/ext/XS/APItest/t/printf.t @@ -8,7 +8,7 @@ BEGIN { } } -use Test::More tests => 15; +use Test::More tests => 11; BEGIN { use_ok('XS::APItest') }; @@ -31,10 +31,6 @@ print_int(3); print_long(4); print_float(4); print_long_double() if $ldok; # val=7 hardwired -print_iv(2); -print_iv(-2); -print_uv(3); -print_nv(6); # Now redirect STDOUT and read from the file ok open(STDOUT, ">&", $oldout), "restore STDOUT"; @@ -43,7 +39,7 @@ print "# Test output by reading from file\n"; # now test the output my @output = map { chomp; $_ } <$foo>; close $foo; -ok @output >= 9, "captured at least nine output lines"; +ok @output >= 4, "captured at least four output lines"; is($output[0], "5.000", "print_double"); is($output[1], "3", "print_int"); @@ -55,11 +51,3 @@ SKIP: { is($output[4], "7.000", "print_long_double"); } -SKIP: { - skip "No perlio", 4 unless $Config{useperlio}; - is($output[5], "2", "print_iv positive"); - is($output[6], "-2", "print_iv negative"); - is($output[7], "3", "print_uv"); - is($output[8], "6.000", "print_nv"); -} -