aboutsummaryrefslogtreecommitdiff
path: root/t/locus.t
blob: 19fc8cc4007e4748a54d6f9110501f55c0b6ef29 (plain)
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
# -*- perl -*-
use strict;
use Test;
use App::Beam::Config::Locus;

plan(tests => 10);

my $loc = new App::Beam::Config::Locus;
ok($loc->format, '');
ok($loc->format('test', 'message'), 'test message');

$loc->add('foo', 10);
ok($loc->format, "foo:10");

$loc->add('foo', 11);
$loc->add('foo', 12);
$loc->add('foo', 13);
ok($loc->format, "foo:10-13");

$loc->add('foo', 24);
$loc->add('foo', 28);
ok($loc->format, "foo:10-13,24,28");
ok($loc->format('test', 'message'), "foo:10-13,24,28: test message");

$loc->add('bar', 1);
$loc->add('baz', 8);
$loc->add('baz', 9);
$loc->add('bar', 5);
ok($loc->format, "foo:10-13,24,28;bar:1,5;baz:8-9");

$loc->fixup_names('foo' => 'Foo', 'bar' => 'BAR');
ok($loc->format, "Foo:10-13,24,28;BAR:1,5;baz:8-9");

$loc->fixup_lines('Foo' => -1, 'baz' => 2);
ok($loc->format, "Foo:9-12,23,27;BAR:1,5;baz:10-11");

$loc->fixup_lines(3);
ok($loc->format, "Foo:12-15,26,30;BAR:4,8;baz:13-14");

Return to:

Send suggestions and report system problems to the System administrator.