Skip to content

Commit

Permalink
[t] Report only those lines that fail this check, not all lines that …
Browse files Browse the repository at this point in the history
…need

checking.

git-svn-id: https://svn.parrot.org/parrot/trunk@25890 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
chromatic committed Feb 20, 2008
1 parent 67b1753 commit b379f24
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions t/codingstd/check_isxxx.t
@@ -1,5 +1,5 @@
#! perl
# Copyright (C) 2006-2007, The Perl Foundation.
# Copyright (C) 2006-2008, The Perl Foundation.
# $Id$

use strict;
Expand Down Expand Up @@ -33,7 +33,7 @@ L<docs/pdds/pdd07_codingstd.pod>
=cut

my $DIST = Parrot::Distribution->new;
my $DIST = Parrot::Distribution->new;
my @files = @ARGV ? @ARGV : $DIST->get_c_language_files();

my @no_explicit_cast;
Expand All @@ -58,31 +58,30 @@ foreach my $file (@files) {

# if we have command line arguments, the file is the full path
# otherwise, use the relevant Parrot:: path method
my $path = @ARGV ? $file : $file->path;

my $buf = $DIST->slurp($path);

my $path = @ARGV ? $file : $file->path;
my $buf = $DIST->slurp($path);
my @buffer_lines = split( /\n/, $buf );

my $i = 1;
my $i = 1;

# get the lines just matching isxxx
my @isxxx_lines = grep { $_->[0] =~ /[^_]($isxxx_functions)\(/ }
my @isxxx_lines = grep { $_->[0] =~ /[^_]($isxxx_functions)\(/ }
map { [ $_, $i++ ] } @buffer_lines;

next unless @isxxx_lines;

# find the instances without the explicit cast
my @no_cast =
grep { $_->[0] !~ /[^_]($isxxx_functions)\(\(unsigned char\)/ } @isxxx_lines;
grep { $_->[0] !~ /[^_]($isxxx_functions)\(\(unsigned char\)/ }
@isxxx_lines;

push @no_explicit_cast, $path . ' (' . join( ", ", map { $_->[1] } @isxxx_lines ) . ")\n"
push @no_explicit_cast, $path . ' (' . join( ", ",
map { $_->[1] } @no_cast ) . ")\n"
if @no_cast;
}

ok( !@no_explicit_cast, 'isxxx() functions cast correctly' )
or diag( "isxxx() function not cast to unsigned char "
. scalar @no_explicit_cast
. @no_explicit_cast
. " files:\n@no_explicit_cast" );

# Local Variables:
Expand Down

0 comments on commit b379f24

Please sign in to comment.