Commits

Shlomi Fish committed fc54d67

Failing test for the while.

ack -a ' $' . does not find all trailing space.

  • Participants
  • Parent commits 3dbc58c
  • Branches ack_a_fails_to_find_trailing_space

Comments (0)

Files changed (22)

File config-inifiles/MANIFEST

 t/non-contiguous-groups.ini
 t/pod-coverage.t
 t/pod.t
+t/style-trailing-space.t
 t/test.ini
 t/trailing-comments.ini

File config-inifiles/README

 
 LICENSE
 
-This program is free software; you can redistribute it and/or 
+This program is free software; you can redistribute it and/or
 modify it under the same terms as Perl itself.
 

File config-inifiles/inc/Test/Run/Builder.pm

         Test::Run::CmdLine::Iface->new(
             {
                 'test_files' => [glob("t/*.t")],
-            }   
+            }
             # 'backend_params' => $self->_get_backend_params(),
         );
 
 sub ACTION_tags
 {
     my $self = shift;
-    return 
+    return
         $self->do_system(
             "ctags",
             qw(-f tags --recurse --totals

File config-inifiles/t/00load.t

 } # endif
 
 
-# TEST 
+# TEST
 # Reread on an open handle
 if( open( CONFIG, "<", t_file("test.ini") ) ) {
   $ini = Config::IniFiles->new(-file => \*CONFIG);
 );
 
 # Try a file with utf-8 encoding (has a Byte-Order-Mark at the start)
-# TEST 
+# TEST
 $ini = Config::IniFiles->new(-file => t_file("en.ini"));
-ok ($ini, 
+ok ($ini,
     "Try a file with utf-8 encoding (has a Byte-Order-Mark at the start)"
 );
 
 
 __END__
 ; File that has comments in the first line
-; Comments are marked with ';'. 
+; Comments are marked with ';'.
 ; This should not fail when checking if the file is valid
 [section]
 parameter=value

File config-inifiles/t/09case.t

     my @values = $ini->val("Section", "parameter");
 
     # TEST
-    is_deeply (\@values, ["Title Case"], 
+    is_deeply (\@values, ["Title Case"],
         "case-insensitive version returns one value"
     );
 }
 
 # TEST
 is (
-    scalar($ini->val('mixedcasesect', 'mixedcaseparam')), 
+    scalar($ini->val('mixedcasesect', 'mixedcaseparam')),
     'MixedCaseVal',
     "Mixed case val.",
 );

File config-inifiles/t/10delta.t

 # TEST
 ok( $es, "Es was instantiated." );
 
-my $estext=slurp(t_file("es.ini")); 
+my $estext=slurp(t_file("es.ini"));
 $estext =~ s/\s*//g;
 
 # test 3
 t_unlink('delta.ini');
 $es->WriteConfig(t_file('delta.ini'), -delta=>1);
 
-my $deltatext=slurp(t_file('delta.ini')); 
+my $deltatext=slurp(t_file('delta.ini'));
 $deltatext =~ s/\s*//g;
 
 # TEST

File config-inifiles/t/15store-and-retrieve-here-doc-terminator.t

 (
     sub {
         my ($cfg) = @_;
-    
+
         $cfg->WriteConfig($filename);
 
         return;

File config-inifiles/t/16case-sensitive-default.t

 #!/usr/bin/perl
 
 # This script attempts to reproduce:
-# https://sourceforge.net/tracker/index.php?func=detail&aid=1565180&group_id=6926&atid=106926 
+# https://sourceforge.net/tracker/index.php?func=detail&aid=1565180&group_id=6926&atid=106926
 
 use strict;
 use warnings;

File config-inifiles/t/17untainted-multiline-values.t

 #!/usr/bin/perl -T
 
 # This script attempts to reproduce:
-# https://sourceforge.net/tracker/index.php?func=detail&aid=1565180&group_id=6926&atid=106926 
+# https://sourceforge.net/tracker/index.php?func=detail&aid=1565180&group_id=6926&atid=106926
 
 use strict;
 use warnings;

File config-inifiles/t/18non-contiguous-groups.t

 #!/usr/bin/perl -T
 
 # This script attempts to reproduce:
-# https://sourceforge.net/tracker/index.php?func=detail&aid=1720915&group_id=6926&atid=106926 
+# https://sourceforge.net/tracker/index.php?func=detail&aid=1720915&group_id=6926&atid=106926
 
 use strict;
 use warnings;

File config-inifiles/t/19param-found-outside-section.t

     # TEST
     ok($ini->exists('GENERAL', 'wrong'),
        "(-fallback) Fallback section catches parameter");
-       
+
     # TEST
     my $newfilename = File::Spec->catfile($dir_name, "new.ini");
     my $content;

File config-inifiles/t/20allowedcommentchars.t

 #!/usr/bin/perl
 
 # This script attempts to reproduce:
-# https://rt.cpan.org/Ticket/Display.html?id=36309 
+# https://rt.cpan.org/Ticket/Display.html?id=36309
 
 use strict;
 use warnings;
 );
 
 {
-    my $cfg = 
+    my $cfg =
         Config::IniFiles->new(
-            -file => $filename, 
+            -file => $filename,
             -allowedcommentchars => '};',
         );
 

File config-inifiles/t/22trailing-comment-lines.t

         "WriteConfig() Preserved end comments."
     );
 
-    # Remove the generated files so they won't pollute the filesystem / 
+    # Remove the generated files so they won't pollute the filesystem /
     # working-copy.
     unlink($new_file);
 }

File config-inifiles/t/23scalar-ref.t

     ok ($conf, "Object was initialised from reference to scalar.");
 
     # TEST
-    is ($conf->val("section1", "key"), 
+    is ($conf->val("section1", "key"),
         "val",
         "Object works."
     );

File config-inifiles/t/24case-sensitive-exists.t

 #!/usr/bin/perl
 
 # This script attempts to reproduce:
-# https://rt.cpan.org/Ticket/Display.html?id=46721 
+# https://rt.cpan.org/Ticket/Display.html?id=46721
 #
 # #46721: $config->exists() does not pay attention to -nocase => 1
 
 
 {
     my $conf = Config::IniFiles->new(
-        -file => File::Spec->catfile(File::Spec->curdir(), 
+        -file => File::Spec->catfile(File::Spec->curdir(),
             't', 'case-sensitive.ini'
         ),
         -nocase => 1
     );
 
     # TEST
-    ok (scalar($conf->exists('FOO', 'BAR')), 
+    ok (scalar($conf->exists('FOO', 'BAR')),
         "->exists() Handles case well"
     );
-    
+
     # TEST
-    is (scalar($conf->val('FOO', 'BAR')), "goodness", 
+    is (scalar($conf->val('FOO', 'BAR')), "goodness",
         "->val() Handles case well"
     );
 }

File config-inifiles/t/25line-endings.t

 {
 
     # being pedantic, we don't take line breaks from this or an external file for granted
-    my $sample_ini = 
+    my $sample_ini =
     "<eol>
     <sol># this is a sample file for testing the proper detection of line endings in Config::Inifiles<eol>
     <sol><eol>
 
         # TEST
         ok($cfg, "Loading from a '$lf_print'-separated file");
-        
+
         # TEST
         my $value = $cfg->val('single values', 'firstval');
         is (

File config-inifiles/t/26scalar-filehandle.t

 #!/usr/bin/perl
 # This script is a regression test for:
-# 
+#
 # https://rt.cpan.org/Ticket/Display.html?id=54997
 #
 # Failure to read the ini file contents from a filehandle made out of a scalar
 #
-# <<< [patch] stat() on unopened filehandle warning thrown when using 
+# <<< [patch] stat() on unopened filehandle warning thrown when using
 # filehandle made from a scalar. >>>
 
 use Test::More;
     ok(!$EVAL_ERROR, "Object was initialised from filehandle made out of a scalar.");
 
     # TEST
-    is ($conf->val("section1", "key"), 
+    is ($conf->val("section1", "key"),
         "val",
         "Object works."
     );

File config-inifiles/t/27empty-ini.t

 
     # TEST
     is_deeply (
-        \@Groups, 
+        \@Groups,
         [],
         "Groups is empty."
     );

File config-inifiles/t/29end-of-line-comment.t

             "end-of-line-comment.ini"), -handle_trailing_comment => 1);
 
     # TEST
-    is($ini->val("section1", "param1"), "value1", 
+    is($ini->val("section1", "param1"), "value1",
         "Comments after ';' should be omitted when tailing comment enabled");
 
     # TEST
-    is($ini->GetParameterTrailingComment("section1", "param1"), 
+    is($ini->GetParameterTrailingComment("section1", "param1"),
         "comment1", "Test GetParameterTrailingComment()");
 
     # Test write back
 
     # Test set()
     # TEST
-    ok($ini->SetParameterTrailingComment("section1", "param1", 
+    ok($ini->SetParameterTrailingComment("section1", "param1",
             "changed comment1"), "Test SetParameterTrailingComment() returns.");
     # TEST
-    is($ini->GetParameterTrailingComment("section1", "param1"), 
+    is($ini->GetParameterTrailingComment("section1", "param1"),
         "changed comment1", "Test whether SetParameterTrailingComments() works.");
 }
 
 # Test of handle_trailing_comment disabled
 {
     my $ini = Config::IniFiles->new( -file => t_file(
-            "end-of-line-comment.ini"), -handle_trailing_comment => 0); 
+            "end-of-line-comment.ini"), -handle_trailing_comment => 0);
     # TEST
-    is($ini->val("section1", "param1"), "value1;comment1", 
+    is($ini->val("section1", "param1"), "value1;comment1",
         "Comments after ';' should be kept when tailing comment disabled");
     # TEST
-    is($ini->GetParameterTrailingComment("section1", "param1"), 
+    is($ini->GetParameterTrailingComment("section1", "param1"),
         "", "Test whether SetParameterTrailingComments() works.");
 }
 
 # Test of default handle_trailing_comment
 {
     # The default handle_trailing_comment param should be off
-    my $ini = Config::IniFiles->new( -file => 
-        t_file("end-of-line-comment.ini") ); 
+    my $ini = Config::IniFiles->new( -file =>
+        t_file("end-of-line-comment.ini") );
     # TEST
-    is($ini->val("section1", "param1"), "value1;comment1", 
+    is($ini->val("section1", "param1"), "value1;comment1",
         "Test default trailing comment, which should be off.");
 }
 

File config-inifiles/t/31comments_with_spaces.t

 # TEST
 is( $ini->val('section','value2'), 'xxx' );
 # TEST
-is( $ini->GetParameterTrailingComment('section','value2'), 'My_Comment'); 
+is( $ini->GetParameterTrailingComment('section','value2'), 'My_Comment');
 
 unlink( $ini_filename );

File config-inifiles/t/32mswin-outputs-contain-crs.t

 {
     my ($userConfig_fn, $section, $param, $value) = @_;
 
-	my $usrCfg = Config::IniFiles->new( -file => $userConfig_fn ) 
+	my $usrCfg = Config::IniFiles->new( -file => $userConfig_fn )
 		or die "Failed! Could not open $userConfig_fn with error @Config::IniFiles::errors\n" ;
 
-	$usrCfg->newval($section, $param, $value) 
+	$usrCfg->newval($section, $param, $value)
 		or die "Could not set newval in writeIni for $section, $param -> $value\n";
-	
+
     my $c = 0;
 
     while ($c < 6)
             print "Writing [$section] $param -> $value\n";
         }
         else
-        { 
+        {
             warn "Error: could not write $param=$value to $userConfig_fn\n";
             sleep 1;
             $c++;

File config-inifiles/t/style-trailing-space.t

+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More;
+
+eval "use Test::TrailingSpace";
+if ($@)
+{
+    plan skip_all => "Test::TrailingSpace required for trailing space test.";
+}
+else
+{
+    plan tests => 1;
+}
+
+my $finder = Test::TrailingSpace->new(
+    {
+        root => '.',
+        filename_regex => qr/(?:(?:\.(?:t|pm|pl|PL|yml|json|arc|vim))|README|Changes|LICENSE)\z/,
+    },
+);
+
+# TEST
+$finder->no_trailing_space(
+    "No trailing space was found."
+);
+