This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #112776] TODO test for warning
authorTony Cook <tony@develop-help.com>
Fri, 31 Aug 2012 10:07:58 +0000 (20:07 +1000)
committerTony Cook <tony@develop-help.com>
Fri, 31 Aug 2012 10:07:58 +0000 (20:07 +1000)
MANIFEST
dist/ExtUtils-ParseXS/t/115-avoid-noise.t [new file with mode: 0644]
dist/ExtUtils-ParseXS/t/XSWarn.xs [new file with mode: 0644]

index 27f9a99..274c325 100644 (file)
--- 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 (file)
index 0000000..21febb2
--- /dev/null
@@ -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 (file)
index 0000000..4ae35ac
--- /dev/null
@@ -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:
+    ;