From 3f305fad20ca6851a9cb5d25370ab5719e7f184e Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Fri, 31 Aug 2012 20:07:58 +1000 Subject: [PATCH] [perl #112776] TODO test for warning --- MANIFEST | 2 ++ dist/ExtUtils-ParseXS/t/115-avoid-noise.t | 22 ++++++++++++++++++++++ dist/ExtUtils-ParseXS/t/XSWarn.xs | 14 ++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 dist/ExtUtils-ParseXS/t/115-avoid-noise.t create mode 100644 dist/ExtUtils-ParseXS/t/XSWarn.xs diff --git a/MANIFEST b/MANIFEST index 27f9a99..274c325 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3190,6 +3190,7 @@ dist/ExtUtils-ParseXS/t/111-analyze_preprocessor_statements.t ExtUtils::ParseXS dist/ExtUtils-ParseXS/t/112-set_cond.t ExtUtils::ParseXS tests dist/ExtUtils-ParseXS/t/113-check_cond_preproc_statements.t ExtUtils::ParseXS tests dist/ExtUtils-ParseXS/t/114-blurt_death_Warn.t ExtUtils::ParseXS tests +dist/ExtUtils-ParseXS/t/115-avoid-noise.t ExtUtils::ParseXS tests dist/ExtUtils-ParseXS/t/501-t-compile.t ExtUtils::Typemaps tests dist/ExtUtils-ParseXS/t/510-t-bare.t ExtUtils::Typemaps tests dist/ExtUtils-ParseXS/t/511-t-whitespace.t ExtUtils::Typemaps tests @@ -3218,6 +3219,7 @@ dist/ExtUtils-ParseXS/t/XSTest.pm Test file for ExtUtils::ParseXS tests dist/ExtUtils-ParseXS/t/XSTest.xs Test file for ExtUtils::ParseXS tests dist/ExtUtils-ParseXS/t/XSUsage.pm ExtUtils::ParseXS tests dist/ExtUtils-ParseXS/t/XSUsage.xs ExtUtils::ParseXS tests +dist/ExtUtils-ParseXS/t/XSWarn.xs ExtUtils::ParseXS tests dist/File-CheckTree/lib/File/CheckTree.pm Perl module supporting wholesale file mode validation dist/File-CheckTree/t/CheckTree.t See if File::CheckTree works dist/Filter-Simple/lib/Filter/Simple.pm Simple frontend to Filter::Util::Call diff --git a/dist/ExtUtils-ParseXS/t/115-avoid-noise.t b/dist/ExtUtils-ParseXS/t/115-avoid-noise.t new file mode 100644 index 0000000..21febb2 --- /dev/null +++ b/dist/ExtUtils-ParseXS/t/115-avoid-noise.t @@ -0,0 +1,22 @@ +#!/usr/bin/perl -w +use strict; +use warnings; +use File::Spec; +use Test::More tests => 1; +use lib qw( lib t/lib ); +use ExtUtils::ParseXS qw(process_file); + +chdir 't' or die "Can't chdir to t/, $!"; + +# Module-Build uses ExtUtils::ParseXS with $^W set, try to avoid +# warning in that case. + +{ + local $TODO = "Test for warning on non-parameter in parameter list"; + my $out; + open my $out_fh, ">", \$out; + my @warnings; + local $SIG{__WARN__} = sub { push @warnings, "@_" }; + process_file(filename => "XSWarn.xs", output => $out_fh); + is_deeply(\@warnings, [], "shouldn't be any warnings"); +} diff --git a/dist/ExtUtils-ParseXS/t/XSWarn.xs b/dist/ExtUtils-ParseXS/t/XSWarn.xs new file mode 100644 index 0000000..4ae35ac --- /dev/null +++ b/dist/ExtUtils-ParseXS/t/XSWarn.xs @@ -0,0 +1,14 @@ +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +MODULE = XSWarn PACKAGE = XSWarn PREFIX = xswarn_ + +PROTOTYPES: DISABLE + +void +xswarn_nonargs() +# see perl #112776 + SV *sv = sv_2mortal(newSV()); + CODE: + ; -- 2.7.4