Debian Codegraph @

test/new_format_type.t

raw
1 #!/usr/bin/env perl
2 # =============================================================================
3 #
4 # This file is part of BibTool.
5 # It is distributed under the GNU General Public License.
6 # See the file COPYING for details.
7 #
8 # (c) 2011-2020 Gerd Neugebauer
9 #
10 # Net: [email protected]
11 #
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2, or (at your option)
15 # any later version.
16 #
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #
26 #*=============================================================================
27
28 =head1 NAME
29
30 new_format_type.t - Test suite for BibTool new.format.type.
31
32 =head1 SYNOPSIS
33
34 new_format_type.t
35
36 =head1 DESCRIPTION
37
38 This module contains some test cases. Running this module as program
39 will run all test cases and print a summary for each. Optionally files
40 *.out and *.err are left if the expected result does not match the
41 actual result.
42
43 =head1 OPTIONS
44
45 none
46
47 =head1 AUTHOR
48
49 Gerd Neugebauer
50
51 =head1 BUGS
52
53 =over 4
54
55 =item *
56
57 ...
58
59 =back
60
61 =cut
62
63 use strict;
64 use BUnit;use warnings;
65
66
67
68 #------------------------------------------------------------------------------
69 BUnit::run(name => 'new_format_type_f1',
70 resource => <<__EOF__ ,
71 new.format.type = {9="\%f"}
72 key.format={\%.9p(author)}
73 __EOF__
74 bib => <<__EOF__ ,
75 \@Misc{ x,
76 author = "A. U. Thor and S. O. Meone and others"
77 }
78 __EOF__
79 expected_err => '',
80 expected_out => <<__EOF__ );
81
82 \@Misc{ AU.SO.ea,
83 author = "A. U. Thor and S. O. Meone and others"
84 }
85 __EOF__
86
87 #------------------------------------------------------------------------------
88 BUnit::run(name => 'new_format_type_f2',
89 resource => <<__EOF__ ,
90 new.format.type = {9="\%+f"}
91 key.format={\%.9p(author)}
92 __EOF__
93 bib => <<__EOF__ ,
94 \@Misc{ x,
95 author = "A. U. Thor and S. O. Meone and others"
96 }
97 __EOF__
98 expected_err => '',
99 expected_out => <<__EOF__ );
100
101 \@Misc{ AU.SO.ea,
102 author = "A. U. Thor and S. O. Meone and others"
103 }
104 __EOF__
105
106 #------------------------------------------------------------------------------
107 BUnit::run(name => 'new_format_type_f3',
108 resource => <<__EOF__ ,
109 new.format.type = {9="\%f[:][-][;]"}
110 key.format={\%.9p(author)}
111 __EOF__
112 bib => <<__EOF__ ,
113 \@Misc{ x,
114 author = "A. U. Thor and S. O. Meone and others"
115 }
116 __EOF__
117 expected_err => '',
118 expected_out => <<__EOF__ );
119
120 \@Misc{ :A-U;.:S-O;.ea,
121 author = "A. U. Thor and S. O. Meone and others"
122 }
123 __EOF__
124
125 #------------------------------------------------------------------------------
126 BUnit::run(name => 'new_format_type_f4',
127 resource => <<__EOF__ ,
128 new.format.type = {9="\%2f"}
129 key.format={\%.9p(author)}
130 __EOF__
131 bib => <<__EOF__ ,
132 \@Misc{ x,
133 author = "Allan Uwe Thor and Stan Oliver Meone and others"
134 }
135 __EOF__
136 expected_err => '',
137 expected_out => <<__EOF__ );
138
139 \@Misc{ AlUw.StOl.ea,
140 author = "Allan Uwe Thor and Stan Oliver Meone and others"
141 }
142 __EOF__
143
144 #------------------------------------------------------------------------------
145 BUnit::run(name => 'new_format_type_l1',
146 resource => <<__EOF__ ,
147 new.format.type = {9="\%l"}
148 key.format={\%.9p(author)}
149 __EOF__
150 bib => <<__EOF__ ,
151 \@Misc{ x,
152 author = "A. U. Thor and S. O. Meone and others"
153 }
154 __EOF__
155 expected_err => '',
156 expected_out => <<__EOF__ );
157
158 \@Misc{ Thor.Meone.ea,
159 author = "A. U. Thor and S. O. Meone and others"
160 }
161 __EOF__
162
163 #------------------------------------------------------------------------------
164 BUnit::run(name => 'new_format_type_v1',
165 resource => <<__EOF__ ,
166 new.format.type = {9="\%v"}
167 key.format={\%.9p(author)}
168 __EOF__
169 bib => <<__EOF__ ,
170 \@Misc{ x,
171 author = "A. U. de Thor and S. O. de la Meone and others"
172 }
173 __EOF__
174 expected_err => '',
175 expected_out => <<__EOF__ );
176
177 \@Misc{ de.dela.ea,
178 author = "A. U. de Thor and S. O. de la Meone and others"
179 }
180 __EOF__
181
182 #------------------------------------------------------------------------------
183 BUnit::run(name => 'new_format_type_v3',
184 resource => <<__EOF__ ,
185 new.format.type = {9="\%v[:][-][;]"}
186 key.format={\%.9p(author)}
187 __EOF__
188 bib => <<__EOF__ ,
189 \@Misc{ x,
190 author = "A. U. de Thor and S. O. de la Meone and others"
191 }
192 __EOF__
193 expected_err => '',
194 expected_out => <<__EOF__ );
195
196 \@Misc{ :de;.:de-la;.ea,
197 author = "A. U. de Thor and S. O. de la Meone and others"
198 }
199 __EOF__
200
201 #------------------------------------------------------------------------------
202 BUnit::run(name => 'new_format_type_v4',
203 resource => <<__EOF__ ,
204 new.format.type = {9="\%1v"}
205 key.format={\%.9p(author)}
206 __EOF__
207 bib => <<__EOF__ ,
208 \@Misc{ x,
209 author = "A. U. de Thor and S. O. de la Meone and others"
210 }
211 __EOF__
212 expected_err => '',
213 expected_out => <<__EOF__ );
214
215 \@Misc{ d.dl.ea,
216 author = "A. U. de Thor and S. O. de la Meone and others"
217 }
218 __EOF__
219
220 #------------------------------------------------------------------------------
221 BUnit::run(name => 'new_format_type_j1',
222 resource => <<__EOF__ ,
223 new.format.type = {9="\%v"}
224 key.format={\%.9p(author)}
225 __EOF__
226 bib => <<__EOF__ ,
227 \@Misc{ x,
228 author = "A. U., Thor, jr. and S. O., Meone, sen. and others"
229 }
230 __EOF__
231 expected_err => '',
232 expected_out => <<__EOF__ );
233
234 \@Misc{ jr.sen.ea,
235 author = "A. U., Thor, jr. and S. O., Meone, sen. and others"
236 }
237 __EOF__
238
239 #------------------------------------------------------------------------------
240 BUnit::run(name => 'new_format_type_j3',
241 resource => <<__EOF__ ,
242 new.format.type = {9="\%v[:][-][;]"}
243 key.format={\%.9p(author)}
244 __EOF__
245 bib => <<__EOF__ ,
246 \@Misc{ x,
247 author = "A. U., Thor, jr. and S. O., Meone, sen. and others"
248 }
249 __EOF__
250 expected_err => '',
251 expected_out => <<__EOF__ );
252
253 \@Misc{ :jr;.:sen;.ea,
254 author = "A. U., Thor, jr. and S. O., Meone, sen. and others"
255 }
256 __EOF__
257
258
259 #------------------------------------------------------------------------------
260 BUnit::run(name => 'new_format_type_j4',
261 resource => <<__EOF__ ,
262 new.format.type = {9="\%1v"}
263 key.format={\%.9p(author)}
264 __EOF__
265 bib => <<__EOF__ ,
266 \@Misc{ x,
267 author = "A. U., Thor, jr. and S. O., Meone, sen. and others"
268 }
269 __EOF__
270 expected_err => '',
271 expected_out => <<__EOF__ );
272
273 \@Misc{ j.s.ea,
274 author = "A. U., Thor, jr. and S. O., Meone, sen. and others"
275 }
276 __EOF__
277
278
279 1;
280 #------------------------------------------------------------------------------
281 # Local Variables:
282 # mode: perl
283 # End: