-
Notifications
You must be signed in to change notification settings - Fork 14
/
delimiters.t
47 lines (26 loc) · 1.07 KB
/
delimiters.t
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
41
42
43
44
45
46
47
use 5.10.0;
use strict;
use warnings;
package TestMe;
use Test::More;
use Try::Tiny;
use Seq::Output::Delimiters;
my $delims = Seq::Output::Delimiters->new( {} );
my $oD = $delims->overlapDelimiter;
my $line = "Stuff;1;2;3/.dasf_)," . "4\t5/6|7";
my $expected = "Stuff,1,2,3,.dasf_),4\t5,6,7";
$delims->cleanDelims->($line);
ok( $line eq $expected, "Clean all delimiters, including / by default" );
my @parts = split( '\t', $line );
ok( @parts == 2, "Splitting on single quoted tab char ('\\t') still works" );
my @parts2 = split( "\t", $line );
ok( @parts == 2, "Splitting on double quoted tab char (\"\\t\") still works" );
$line = "Stuff;;1;;2;;;3" . "$oD$oD$oD" . "4\t5//6||7|";
$expected = "Stuff,1,2,3,4\t5,6,7";
$delims->cleanDelims->($line);
ok( $line eq $expected, "Clean all delimiters even when many instances in a row" );
@parts = split( '\t', $line );
ok( @parts == 2, "Splitting on single quoted tab char ('\\t') still works" );
@parts2 = split( "\t", $line );
ok( @parts == 2, "Splitting on double quoted tab char (\"\\t\") still works" );
done_testing();