File: 34join.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 (23 lines) | stat: -rw-r--r-- 537 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
#!/usr/bin/perl

use v5.14;
use warnings;

use Test2::V0;

use String::Tagged;

{
   my $str = String::Tagged->join( ", ",
      String::Tagged->new_tagged( "one", val => 1 ),
      String::Tagged->new_tagged( "two", val => 2 ),
      String::Tagged->new_tagged( "three", val => 3 ),
   );

   isa_ok( $str, [ "String::Tagged" ], 'String::Tagged->join returns String::Tagged' );
   is( "$str", "one, two, three", '->join yielded correct text' );

   is( $str->get_tag_at( 5, "val" ), 2, '->join preserves inner tags' );
}

done_testing;