2 # Copyright (C) 2006-2009, Parrot Foundation.
8 use lib qw( . lib ../lib ../../lib );
9 use Test::More tests => 1;
10 use Parrot::Distribution;
11 use Parrot::Test::Util::Runloop;
15 t/codingstd/check_isxxx.t - checks that the isxxx() functions are passed
21 % prove t/codingstd/check_isxxx.t
24 % perl t/codingstd/check_isxxx.t src/foo.c include/parrot/bar.h
28 Checks all C language files to make sure that arguments to the isxxx()
29 functions are explicitly cast to unsigned char.
33 L<docs/pdds/pdd07_codingstd.pod>
37 my $DIST = Parrot::Distribution->new;
38 my @files = @ARGV ? <@ARGV> : $DIST->get_c_language_files();
42 my @isxxx_functions_list = qw(
56 my $isxxx_functions = join '|', @isxxx_functions_list;
61 # does the line contain an isxxx call?
62 return 1 unless $line =~ /[^_]($isxxx_functions)\([^)]+/;
63 # is the line missing a cast?
64 return 1 unless $line !~ /[^_]($isxxx_functions)\(\(unsigned char\)/;
69 Parrot::Test::Util::Runloop->testloop(
70 name => 'isxxx() functions cast correctly',
72 per_line => \&check_isxxx,
73 diag_prefix => 'isxxx() function not cast to unsigned char'
78 # cperl-indent-level: 4
81 # vim: expandtab shiftwidth=4: