# New Ticket Created by  Moritz Lenz 
# Please include the string:  [perl #55346]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=55346 >


Attached patch adds a script to tools/ that walks through a test
specification file (t/spectest_regression.data by default) and prints a
list of files that are marked as pure, but still contain '#?rakudo'
fudge directives.

particle++ for suggesting it.

It's only tested under linux so far, so please also test on MacOS and
Windows before applying.

Cheers,
Moritz

-- 
Moritz Lenz
http://moritz.faui2k3.org/ |  http://perl-6.de/
Index: MANIFEST
===================================================================
--- MANIFEST	(revision 28098)
+++ MANIFEST	(working copy)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Wed Jun  4 20:37:00 2008 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Thu Jun  5 15:13:47 2008 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -1961,6 +1961,7 @@
 languages/perl6/t/harness                                   [perl6]
 languages/perl6/t/pmc/mutable.t                             [perl6]
 languages/perl6/t/spectest_regression.data                  [perl6]
+languages/perl6/tools/fudge_purity_inspector.pl             [perl6]
 languages/perl6/tools/update_passing_test_data.pl           [perl6]
 languages/pheme/MAINTAINER                                  [pheme]
 languages/pheme/MANIFEST                                    [pheme]
Index: languages/perl6/tools/fudge_purity_inspector.pl
===================================================================
--- languages/perl6/tools/fudge_purity_inspector.pl	(revision 0)
+++ languages/perl6/tools/fudge_purity_inspector.pl	(revision 0)
@@ -0,0 +1,39 @@
+#! perl -w
+# Copyright (C) 2008, The Perl Foundation.
+# $Id$
+use strict;
+use warnings;
+
+my $input_file = shift @ARGV || 't/spectest_regression.data';
+my $impl = 'rakudo';
+
+open my $fh, '<', $input_file
+    or die "Can't open '$input_file' for reading: $!";
+
+print "The following files, if any, contain fudge directives,\n";
+print "although they are marked as pure:\n";
+
+while (<$fh>){
+    chomp;
+    next if  m/^#/ || m/^\s*$/;
+    my ($file, $comment) = split m/\s*#\s*/;
+    if ($comment && $comment eq 'pure'){
+        check_file_and_warn($file);
+    }
+}
+
+sub check_file_and_warn {
+    my $filename = shift;
+    $filename = "t/spec/$filename";
+#    warn "checking file <$filename>\n";
+    open my $fh, '<', $filename
+        or die "Can't opne file '$filename' for reading: $!";
+    my $re = qr{^\s*#\?$impl};
+    while (<$fh>) {
+        if (m/$re/){
+            print $filename, "\n";
+            last;
+        }
+    }
+    close $fh;
+}

Property changes on: languages/perl6/tools/fudge_purity_inspector.pl
___________________________________________________________________
Name: svn:mime-type
   + text/plain; charset=UTF-8
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Reply via email to