1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-16 22:14:53 +01:00
git/t/Git-SVN/Utils/fatal.t
Jonathan Nieder 2179b6727e mark perl test scripts executable
These scripts are not run directly as part of a normal build, so no
one noticed that they did not have the +x bit.  Mark them executable
to make it more obvious that they can be run directly (when debugging,
for example).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-11-25 15:01:22 -08:00

34 lines
658 B
Perl
Executable file

#!/usr/bin/perl
use strict;
use warnings;
use Test::More 'no_plan';
BEGIN {
# Override exit at BEGIN time before Git::SVN::Utils is loaded
# so it will see our local exit later.
*CORE::GLOBAL::exit = sub(;$) {
return @_ ? CORE::exit($_[0]) : CORE::exit();
};
}
use Git::SVN::Utils qw(fatal);
# fatal()
{
# Capture the exit code and prevent exit.
my $exit_status;
no warnings 'redefine';
local *CORE::GLOBAL::exit = sub { $exit_status = $_[0] || 0 };
# Trap fatal's message to STDERR
my $stderr;
close STDERR;
ok open STDERR, ">", \$stderr;
fatal "Some", "Stuff", "Happened";
is $stderr, "Some Stuff Happened\n";
is $exit_status, 1;
}