File: 10debugprint.t

package info (click to toggle)
libstring-tagged-perl 0.24-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 304 kB
  • sloc: perl: 2,105; makefile: 2
file content (40 lines) | stat: -rw-r--r-- 784 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
34
35
36
37
38
39
40
#!/usr/bin/perl

use v5.14;
use warnings;

use Test2::V0;

use String::Tagged;

my $str = String::Tagged->new( "Hello, world" );

is( $str->debug_sprintf,
    "  Hello, world\n",
    'untagged' );

$str->apply_tag( 0, 5, word => 1 );

is( $str->debug_sprintf,
    "  Hello, world\n" .
    "  [---]         word => 1\n",
    'one tag' );

$str->apply_tag( 6, 1, space => 1 );

is( $str->debug_sprintf,
    "  Hello, world\n" .
    "  [---]         word  => 1\n" .
    "        |       space => 1\n",
    'single-char tag' );

$str->apply_tag( -1, -1, everywhere => 1 );

is( $str->debug_sprintf,
    "  Hello, world\n" .
    "  [---]         word       => 1\n" .
    " <[----------]> everywhere => 1\n" .
    "        |       space      => 1\n",
    'everywhere tag' );

done_testing;