"Fossies" - the Fresh Open Source Software Archive 
Member "memcached-1.6.15/t/whitespace.t" (30 Mar 2022, 1685 Bytes) of package /linux/www/memcached-1.6.15.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
See also the latest
Fossies "Diffs" side-by-side code changes report for "whitespace.t":
1.6.14_vs_1.6.15.
1 #!/usr/bin/perl
2 use strict;
3 use FindBin qw($Bin);
4 our @files;
5
6 BEGIN {
7 chdir "$Bin/.." or die;
8 unless (-d "$Bin/../.git") {
9 use Test::More;
10 plan skip_all => "Skipping test because this does not appear to be a memcached git working directory";
11 exit 0;
12 }
13
14 my @exempted = qw(Makefile.am ChangeLog doc/Makefile.am README README.md compile_commands.json md5.c md5.h);
15 push(@exempted, glob("doc/*.xml"));
16 push(@exempted, glob("doc/*.full"));
17 push(@exempted, glob("doc/xml2rfc/*.xsl"));
18 push(@exempted, glob("doc/xml2rfc/*.dtd"));
19 push(@exempted, glob("m4/*backport*m4"));
20 push(@exempted, glob("*.orig"));
21 push(@exempted, glob(".*.swp"));
22 push(@exempted, glob("queue.h"));
23 my %exempted_hash = map { $_ => 1 } @exempted;
24
25 my @stuff = split /\0/, `git ls-files -z -c -m -o --exclude-standard`;
26 @files = grep { ! $exempted_hash{$_} && $_ !~ m/^vendor/ } @stuff;
27
28 # We won't find any files if git isn't installed. If git isn't
29 # installed, they're probably not doing any useful development, or
30 # at the very least am will clean up whitespace when we receive
31 # their patch.
32 unless (@files) {
33 use Test::More;
34 plan skip_all => "Skipping tests probably because you don't have git.";
35 exit 0;
36 }
37 }
38
39 use Test::More tests => scalar(@files);
40
41 foreach my $f (@files) {
42 open(my $fh, $f) or die "Cannot open file $f: $!";
43 my $before = do { local $/; <$fh>; };
44 close ($fh);
45 my $after = $before;
46 $after =~ s/\t/ /g;
47 $after =~ s/ +$//mg;
48 $after .= "\n" unless $after =~ /\n$/;
49 ok ($after eq $before, "$f (see devtools/clean-whitespace.pl)");
50 }