summaryrefslogtreecommitdiffstats
path: root/t/detect.t
blob: feaea1c545e9526decdb526477934f5514d9ff44 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use lib 't/lib';
use TestHelpers 'output_like';

output_like(<<EOF,
    use Carp::Always::Color;
    warn "foo";
EOF
    qr/\e\[33mfoo\e\[m at -e line 2\b/,
    "detection works for terminal output");

output_like(<<EOF,
    my \$stderr;
    BEGIN {
        close(STDERR);
        open(STDERR, '>', \\\$stderr);
    }
    use Carp::Always::Color;
    warn "foo";
    print \$stderr;
EOF
    qr+foo at -e line 7\b+,
    "detection works for terminal output");

done_testing;