1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
10 my @known_authors = do {
11 # according to #p5p this is how one safely reads random unicode
12 # this set of boilerplate is insane... wasn't perl unicode-king...?
15 require PerlIO::encoding;
16 local $PerlIO::encoding::fallback = Encode::FB_CROAK();
18 open (my $fh, '<:encoding(UTF-8)', 'AUTHORS') or die "Unable to open AUTHORS - can't happen: $!\n";
19 map { chomp; ( ( ! $_ or $_ =~ /^\s*\#/ ) ? () : $_ ) } <$fh>;
21 } or die "Known AUTHORS file seems empty... can't happen...";
24 [ grep { /^\s/ or /\s\s/ } @known_authors ],
26 "No entries with leading or doubled space",
30 [ grep { / \:[^\s\/] /x or /^ [^:]*? \s+ \: /x } @known_authors ],
32 "No entries with malformed nicks",
37 [ sort { lc $a cmp lc $b } @known_authors ],
38 'Author list is case-insensitively sorted'
41 my $email_re = qr/( \< [^\<\>]+ \> ) $/x;
44 for (@known_authors) {
45 my ($name_email) = m/ ^ (?: [^\:]+ \: \s )? (.+) /x;
46 my ($email) = $name_email =~ $email_re;
48 fail "Duplicate found: $name_email" if (
49 $known_authors{$name_email}++
51 ( $email and $known_authors{$email}++ )
56 if (length $ENV{PATH}) {
57 ( $ENV{PATH} ) = join ( $Config{path_sep},
58 map { length($_) ? File::Spec->rel2abs($_) : () }
59 split /\Q$Config{path_sep}/, $ENV{PATH}
63 # no git-check when smoking a PR
66 ! $ENV{TRAVIS_PULL_REQUEST}
68 $ENV{TRAVIS_PULL_REQUEST} eq "false"
74 binmode (Test::More->builder->$_, ':utf8') for qw/output failure_output todo_output/;
76 # this may fail - not every system has git
79 { my ($gitname) = m/^ \s* \d+ \s* (.+?) \s* $/mx; utf8::decode($gitname); $gitname }
80 qx( git shortlog -e -s )
82 my ($eml) = $_ =~ $email_re;
84 ok $known_authors{$eml},
85 "Commit author '$_' (from .mailmap-aware `git shortlog -e -s`) reflected in ./AUTHORS";