~ubuntu-branches/ubuntu/raring/libmarc-lint-perl/raring

« back to all changes in this revision

Viewing changes to t/test880and6.t

  • Committer: Package Import Robot
  • Author(s): Florian Schlichting, Ryan Niebur, gregor herrmann, Ansgar Burchardt, Florian Schlichting
  • Date: 2012-08-31 23:09:21 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20120831230921-dzjf0njsoqfi29dg
Tags: 1.45-1
[ Ryan Niebur ]
* Email change: Jonathan Yu -> jawnsy@cpan.org.

[ gregor herrmann ]
* debian/rules: switch order of arguments to dh.

[ Ansgar Burchardt ]
* debian/control: Convert Vcs-* fields to Git.

[ gregor herrmann ]
* debian/control: update {versioned,alternative} (build) dependencies.

[ Florian Schlichting ]
* Imported Upstream version 1.45.
* Bumped Standards-Version to 3.9.3 (use copyright-format 1.0).
* Bumped years of upstream copyright.
* Bumped dh compatibility to level 8 (no changes necessary).
* Switched to source format 3.0 (quilt).
* Refreshed and forwarded 01_fix-man-name.patch.
* Added myself to uploaders and copyright.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!perl
2
2
 
3
 
 
4
 
 
5
3
#Tests for field 880 and for subfield 6
6
4
 
7
 
 
8
 
 
9
5
use strict;
10
 
 
11
6
use warnings;
12
 
 
13
7
use File::Spec;
14
 
 
15
8
use Test::More tests=>6;
16
9
 
17
 
 
18
 
 
19
10
BEGIN { use_ok( 'MARC::File::USMARC' ); }
20
 
 
21
11
BEGIN { use_ok( 'MARC::Lint' ); }
22
12
 
23
 
 
24
 
 
25
13
FROM_TEXT: {
26
 
 
27
14
    my $marc = MARC::Record->new();
28
 
 
29
15
    isa_ok( $marc, 'MARC::Record', 'MARC record' );
30
16
 
31
 
 
32
 
 
33
17
    $marc->leader("00000nam  22002538a 4500"); 
34
18
 
35
 
 
36
 
 
37
19
    my $nfields = $marc->add_fields(
38
 
 
39
20
        ['001', 'ttt07000001 '],
40
 
 
41
21
        ['003', 'TEST '],
42
 
 
43
22
        ['008', '070520s2007    ilu           000 0 eng d',
44
 
 
45
23
        ],
46
 
 
47
24
        ['040', "", "",
48
 
 
49
25
            a => 'TEST',
50
 
 
51
26
            c => 'TEST',
52
 
 
53
27
         ],
54
 
 
55
28
        ['050', "", "4",
56
 
 
57
29
            a => 'RZ999',
58
 
 
59
30
            b => '.J66 2007',
60
 
 
61
31
         ],
62
 
 
63
32
        ['082', "0", "4",
64
 
 
65
33
            a => '615.8/9',
66
 
 
67
34
            2 => '22'
68
 
 
69
35
         ],
70
 
 
71
36
        [100, "1","", 
72
 
 
73
37
            a => "Jones, John.",
74
 
 
75
38
        ],
76
 
 
77
39
        [245, "1","0",
78
 
 
79
40
            6 => "880-02",
80
 
 
81
41
            a => "Test 880.",
82
 
 
83
42
        ],
84
 
 
85
43
        [260, "", "",
86
 
 
87
44
            a => "Mount Morris, Ill. :",
88
 
 
89
45
            b => "B. Baldus,",
90
 
 
91
46
            c => "2007.",
92
 
 
93
47
            ],
94
 
 
95
48
        [300, "", "",
96
 
 
97
49
            a => "1 v. ;",
98
 
 
99
50
            c => "23 cm.",
100
 
 
101
51
        ],
102
 
 
103
52
        [880, "1", "0",
104
 
 
105
53
            6 => '245-02/$1',
106
 
 
107
54
            a => "<Title in CJK script>.",
108
 
 
109
55
        ],
110
 
 
111
56
    );
112
 
 
113
57
    is( $nfields, 11, "All the fields added OK" );
114
58
 
115
 
 
116
 
 
117
59
    my @expected = (
118
 
 
119
60
#        (undef),
120
 
 
121
61
        #q{},
122
 
 
123
62
    );
124
63
 
125
 
 
126
 
 
127
64
    my $lint = new MARC::Lint;
128
 
 
129
65
    isa_ok( $lint, 'MARC::Lint' );
130
66
 
131
 
 
132
 
 
133
67
    $lint->check_record( $marc );
134
 
 
135
68
    my @warnings = $lint->warnings;
136
 
 
137
69
    while ( @warnings ) {
138
 
 
139
70
        my $expected = shift @expected;
140
 
 
141
71
        my $actual = shift @warnings;
142
72
 
143
 
 
144
 
 
145
73
        is( $actual, $expected, "Checking expected messages" );
146
 
 
147
74
    }
148
 
 
149
75
    is( scalar @expected, 0, "All expected messages exhausted." );
150
 
 
151
76
}
152
77
 
153
 
 
154