X-Git-Url: http://git.maemo.org/git/?p=dh-make-perl;a=blobdiff_plain;f=dev%2Farm%2Flibnet-ssleay-perl%2Flibnet-ssleay-perl-1.35%2Ft%2Flocal%2F00_ptr_cast.t;fp=dev%2Farm%2Flibnet-ssleay-perl%2Flibnet-ssleay-perl-1.35%2Ft%2Flocal%2F00_ptr_cast.t;h=2494a520602d0ea56f7543bf123fd7335e55920a;hp=0000000000000000000000000000000000000000;hb=f477fa73365d491991707e7ed9217b48d6994551;hpb=da95c414033799c3a62606f299c3c00b5c77ca11 diff --git a/dev/arm/libnet-ssleay-perl/libnet-ssleay-perl-1.35/t/local/00_ptr_cast.t b/dev/arm/libnet-ssleay-perl/libnet-ssleay-perl-1.35/t/local/00_ptr_cast.t new file mode 100644 index 0000000..2494a52 --- /dev/null +++ b/dev/arm/libnet-ssleay-perl/libnet-ssleay-perl-1.35/t/local/00_ptr_cast.t @@ -0,0 +1,36 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use File::Spec; +use Test::More tests => 5; +use Symbol qw(gensym); +use IPC::Open3; +use Config; + +my $input = File::Spec->catfile(qw( t local ptr_cast_test.c )); +my $output = File::Spec->catfile(qw( t local ptr_cast_test )); + +unlink $output; + +my $out = gensym(); +my $err = gensym(); + +my @extraargs; +push(@extraargs, '/nologo') if $^O eq 'MSWin32' && $Config{cc} eq 'cl'; +my $cmd = "$Config{cc} -o $output $input " . join(' ', @extraargs); +diag( "compiling test program with: $cmd" ); +my $pid = open3(undef, $out, $err, $cmd); +waitpid $pid, 0; + +is( $?, 0, 'compiling ptr_cast_test.c' ); + +is( do { local $/ = undef; <$err>}, '', 'STDERR empty after compiling' ); + +$pid = open3(undef, $out, $err, "./$output"); +waitpid $pid, 0; + +is( $?, 0, './ptr_cast_test exited with 0' ); + +like( do { local $/ = undef; <$out> }, qr/ptr_cast_test:\s+ok\s+/, 'casting pointer integer and back worked' ); +ok( !do { local $/ = undef; <$err> }, 'STDERR empty after running' );