Don't call debug_backtrace if it's disabled to avoid a lot of E_WARNING
[mediawiki.git] / t / maint / eol-style.t
blob2e281dc457986dd2ad3c6ea7818a66008961f7bc
1 #!/usr/bin/env perl
3 # Based on php-tag.t
5 use strict;
6 use warnings;
8 use Test::More;
9 use File::Find;
10 use IPC::Open3;
11 use File::Spec;
12 use Symbol qw(gensym);
14 my $ext = qr/(?: php | inc | txt | sql | t)/x;
15 my @files;
17 find( sub { push @files, $File::Find::name if -f && /\. $ext $/x }, '.' );
19 plan tests => scalar @files ;
21 for my $file (@files) {
22 open NULL, '+>', File::Spec->devnull and \*NULL or die;
23 my $pid = open3('<&NULL', \*P, '>&NULL', qw'svn propget svn:eol-style', $file);
24 my $res = do { local $/; <P> . "" };
25 chomp $res;
26 waitpid $pid, 0;
28 if ( $? != 0 ) {
29 pass "svn propget failed, $file probably not under version control";
30 } elsif ( $res eq 'native' ) {
31 pass "$file svn:eol-style is 'native'";
32 } else {
33 fail "$file svn:eol-style is '$res', should be 'native'";