Documentation/describe: improve one-line summary
[git.git] / t / Git-SVN / Utils / fatal.t
blob49e1438295c0c332d1b95ab629d938c8bd1e6dfa
1 #!/usr/bin/perl
3 use strict;
4 use warnings;
6 use Test::More 'no_plan';
8 BEGIN {
9 # Override exit at BEGIN time before Git::SVN::Utils is loaded
10 # so it will see our local exit later.
11 *CORE::GLOBAL::exit = sub(;$) {
12 return @_ ? CORE::exit($_[0]) : CORE::exit();
16 use Git::SVN::Utils qw(fatal);
18 # fatal()
20 # Capture the exit code and prevent exit.
21 my $exit_status;
22 no warnings 'redefine';
23 local *CORE::GLOBAL::exit = sub { $exit_status = $_[0] || 0 };
25 # Trap fatal's message to STDERR
26 my $stderr;
27 close STDERR;
28 ok open STDERR, ">", \$stderr;
30 fatal "Some", "Stuff", "Happened";
32 is $stderr, "Some Stuff Happened\n";
33 is $exit_status, 1;