| 1 | # | ||||||||||
| 2 | # This file is part of Test-Apocalypse | ||||||||||
| 3 | # | ||||||||||
| 4 | # This software is copyright (c) 2014 by Apocalypse. | ||||||||||
| 5 | # | ||||||||||
| 6 | # This is free software; you can redistribute it and/or modify it under | ||||||||||
| 7 | # the same terms as the Perl 5 programming language system itself. | ||||||||||
| 8 | # | ||||||||||
| 9 | 38 | ▶ | use strict; use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | package Test::Apocalypse::DOSnewline; | ||||||||||
| 11 | 38 | $Test::Apocalypse::DOSnewline::VERSION = '1.006'; | |||||||||
| 12 | 38 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 38 | $Test::Apocalypse::DOSnewline::AUTHORITY = 'cpan:APOCAL'; | |||||||||
| 14 | } | ||||||||||
| 15 | |||||||||||
| 16 | # ABSTRACT: Plugin to detect presence of DOS newlines | ||||||||||
| 17 | |||||||||||
| 18 | 38 | ▶ | use Test::More; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 38 | ▶ | use File::Find::Rule 0.32; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | |||||||||||
| 21 | # TODO If a win32 user downloads the tarball, it will have DOS newlines in it? | ||||||||||
| 22 | 37 | ▶ | sub _do_automated { 0 } | ||||||||
|
Subroutine
_do_automated: called CC=1 SCAR=0.0
| |||||||||||
| 23 | |||||||||||
| 24 | 0 | ▶ | sub do_test { | ||||||||
|
Subroutine
do_test: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 25 | 0 | plan tests => 1; | |||||||||
| 26 | |||||||||||
| 27 | # generate the file list | ||||||||||
| 28 | 0 | my @files = File::Find::Rule->grep( qr/\r\n/ )->in( '.' ); | |||||||||
| 29 | |||||||||||
| 30 | # for now, we skip SVN + git stuff | ||||||||||
| 31 | # also skip any tarballs | ||||||||||
| 32 | 0 | @files = grep { $_ !~ /(?:\.svn\/|\.git\/|tar(?:\.gz|\.bz2)?|tgz|zip)/ } @files; | |||||||||
| 33 | |||||||||||
| 34 | # test it! | ||||||||||
| 35 | 0 | ▶ | if ( scalar @files ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 0 | fail( 'DOS-style newline detected in the distribution' ); | |||||||||
| 37 | 0 | foreach my $f ( @files ) { | |||||||||
| 38 | 0 | diag( "DOS-style newline found in: $f" ); | |||||||||
| 39 | } | ||||||||||
| 40 | } else { | ||||||||||
| 41 | 0 | pass( 'No files have DOS-style newline in it' ); | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 0 | return; | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 38 | 1; | |||||||||
| 48 | |||||||||||
| 49 | __END__ | ||||||||||