File: 01-char_consistent.t

package info (click to toggle)
libmarc-spec-perl 2.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 244 kB
  • sloc: perl: 686; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 837 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
use Test::More;
use MARC::Spec;
use MARC::Spec::Field;

# new Field
my $field = MARC::Spec::Field->new('650');

# new MARCspec with field
my $ms = MARC::Spec->new($field);

$field->char_start(0);

ok $ms->field->char_start == 0, 'char_start 0';
ok $ms->field->char_end eq 0, 'char_end 0';
ok $ms->field->char_length == 1, 'char_lenght -1';
ok $ms->field->to_string() eq '650[0-#]/0', 'base default got '.$ms->field->to_string();

$field->char_end(2);

ok $ms->field->char_start == 0, 'char_start 0';
ok $ms->field->char_end == 2, 'char_end 2';
ok $ms->field->char_length == 3, 'char_lenght 3';
ok $ms->field->to_string() eq '650[0-#]/0-2', 'base 0-2';


$field->char_end('#');

ok $ms->field->char_length == -1, 'char_lenght -1';
ok $ms->field->to_string() eq '650[0-#]', 'base string 0-#';

done_testing();