File: tie_output.t

package info (click to toggle)
libtest-base-perl 0.79-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 664 kB
  • ctags: 108
  • sloc: perl: 952; makefile: 2
file content (21 lines) | stat: -rw-r--r-- 394 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use Test::Base tests => 3;

my $out = "Stuff\n";
my $err = '';

tie_output(*STDOUT, $out);
tie_output(*STDERR, $err);

warn "Keep out!\n";

print "The eagle has landed\n";

is $out, "Stuff\nThe eagle has landed\n";

print "This bird had flown\n";

is $out, "Stuff\nThe eagle has landed\nThis bird had flown\n";

print STDERR "You 'lil rascal...\n";

is $err, "Keep out!\nYou 'lil rascal...\n";