File: 20print.t

package info (click to toggle)
libstring-tagged-terminal-perl 0.08-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 172 kB
  • sloc: perl: 653; makefile: 13
file content (33 lines) | stat: -rw-r--r-- 605 bytes parent folder | download | duplicates (2)
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
29
30
31
32
33
#!/usr/bin/perl

use v5.14;
use warnings;

use Test2::V0;

use String::Tagged::Terminal;

my $st = String::Tagged::Terminal->new
   ->append_tagged( "a string with " )
   ->append_tagged( "bold", bold => 1 )
   ->append_tagged( " formatting" );

{
   open my $fh, ">", \my $output;

   $st->print_to_terminal( $fh );

   is( $output, "a string with \e[1mbold\e[m formatting",
      'printed correct output' );
}

{
   open my $fh, ">", \my $output;

   $st->say_to_terminal( $fh );

   like( $output, qr/a string with \e\[1mbold\e\[m formatting\r?\n/,
      'output includes linefeed' );
}

done_testing;