xref: /openbsd-src/gnu/usr.bin/perl/cpan/Test-Simple/t/Legacy_And_Test2/preload_diag_note.t (revision 5759b3d249badf144a6240f7eec4dcf9df003e6b)
1use strict;
2use warnings;
3
4if ($] lt "5.008") {
5    print "1..0 # SKIP Test cannot run on perls below 5.8.0\n";
6    exit 0;
7}
8
9BEGIN {
10    require Test2::API;
11    Test2::API::test2_start_preload();
12}
13
14use Test::More;
15
16my ($stdout, $stderr) = ('', '');
17{
18    local *STDOUT;
19    open(STDOUT, '>', \$stdout) or die "Could not open temp STDOUT";
20
21    local *STDERR;
22    open(STDERR, '>', \$stderr) or die "Could not open temp STDOUT";
23
24    diag("test\n", "diag\nfoo");
25    note("test\n", "note\nbar");
26}
27
28Test2::API::test2_stop_preload();
29
30is($stdout, <<EOT, "Got stdout");
31# test
32# note
33# bar
34EOT
35
36is($stderr, <<EOT, "Got stderr");
37# test
38# diag
39# foo
40EOT
41
42done_testing;
43