Debian Codegraph @

test/crossref_map.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) 2016-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 crossref_map.t - Test suite for BibTool crossref.map.
31
32 =head1 SYNOPSIS
33
34 crossref_map.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 =cut
52
53 use strict;
54 use BUnit;use warnings;
55
56
57 #------------------------------------------------------------------------------
58 BUnit::run(name => 'crossref_map_err_1',
59 resource => 'crossref.map {}',
60 expected_err => <<__EOF__,
61
62
63 ^
64 *** BibTool ERROR: List of symbols expected.
65 __EOF__
66 expected_out => '' );
67
68 #------------------------------------------------------------------------------
69 BUnit::run(name => 'crossref_map_err_2',
70 resource => 'crossref.map {,}',
71 expected_err => <<__EOF__,
72
73 ,
74 ^
75 *** BibTool ERROR: List of symbols expected.
76 __EOF__
77 expected_out => '' );
78
79 #------------------------------------------------------------------------------
80 BUnit::run(name => 'crossref_map_err_3',
81 resource => 'crossref.map {""}',
82 expected_err => <<__EOF__,
83
84 ""
85 ^
86 *** BibTool ERROR: List of symbols expected.
87 __EOF__
88 expected_out => '' );
89
90 #------------------------------------------------------------------------------
91 BUnit::run(name => 'crossref_map_err_4',
92 resource => 'crossref.map {123}',
93 expected_err => <<__EOF__,
94
95 123
96 ^
97 *** BibTool ERROR: List of symbols expected.
98 __EOF__
99 expected_out => '' );
100
101 #------------------------------------------------------------------------------
102 BUnit::run(name => 'crossref_map_err_5',
103 resource => 'crossref.map {abc}',
104 expected_err => <<__EOF__,
105
106 abc
107 ___^
108 *** BibTool ERROR: Symbol expected.
109 __EOF__
110 expected_out => '' );
111
112 #------------------------------------------------------------------------------
113 BUnit::run(name => 'crossref_map_err_6',
114 resource => 'crossref.map {{}}',
115 expected_err => <<__EOF__,
116
117 {}
118 __^
119 *** BibTool ERROR: Symbol expected.
120 __EOF__
121 expected_out => '' );
122
123 #------------------------------------------------------------------------------
124 BUnit::run(name => 'crossref_map_err_7',
125 resource => 'crossref.map {{abc}}',
126 expected_err => <<__EOF__,
127
128 {abc}
129 _____^
130 *** BibTool ERROR: Symbol expected.
131 __EOF__
132 expected_out => '' );
133
134 #------------------------------------------------------------------------------
135 BUnit::run(name => 'crossref_map_err_8',
136 resource => 'crossref.map {{a c}}',
137 expected_err => <<__EOF__,
138
139 {a c}
140 _____^
141 *** BibTool ERROR: Symbol expected.
142 __EOF__
143 expected_out => '' );
144
145 #------------------------------------------------------------------------------
146 BUnit::run(name => 'crossref_map_err_10',
147 resource => 'crossref.map {{}#}',
148 expected_err => <<__EOF__,
149
150 {}#
151 ___^
152 *** BibTool ERROR: Symbol expected.
153 __EOF__
154 expected_out => '' );
155
156 #------------------------------------------------------------------------------
157 BUnit::run(name => 'crossref_map_err_11',
158 resource => 'crossref.map {{} 123}',
159 expected_err => <<__EOF__,
160
161 {} 123
162 ___^
163 *** BibTool ERROR: Symbol expected.
164 __EOF__
165 expected_out => '' );
166
167 #------------------------------------------------------------------------------
168 BUnit::run(name => 'crossref_map_err_12',
169 resource => 'crossref.map {{} "123"}',
170 expected_err => <<__EOF__,
171
172 {} "123"
173 ___^
174 *** BibTool ERROR: Symbol expected.
175 __EOF__
176 expected_out => '' );
177
178 #------------------------------------------------------------------------------
179 BUnit::run(name => 'crossref_map_err_20',
180 resource => 'crossref.map {{abc} def}',
181 expected_err => <<__EOF__,
182
183 {abc} def
184 _________^
185 *** BibTool ERROR: List of symbols expected.
186 __EOF__
187 expected_out => '' );
188
189 #------------------------------------------------------------------------------
190 BUnit::run(name => 'crossref_map_err_21',
191 resource => 'crossref.map {{abc} def#}',
192 expected_err => <<__EOF__,
193
194 {abc} def#
195 __________^
196 *** BibTool ERROR: List of symbols expected.
197 __EOF__
198 expected_out => '' );
199
200 #------------------------------------------------------------------------------
201 BUnit::run(name => 'crossref_map_err_22',
202 resource => 'crossref.map {{abc} def 123}',
203 expected_err => <<__EOF__,
204
205 {abc} def 123
206 __________^
207 *** BibTool ERROR: List of symbols expected.
208 __EOF__
209 expected_out => '' );
210
211 #------------------------------------------------------------------------------
212 BUnit::run(name => 'crossref_map_err_23',
213 resource => 'crossref.map {{abc} def "123"}',
214 expected_err => <<__EOF__,
215
216 {abc} def "123"
217 __________^
218 *** BibTool ERROR: List of symbols expected.
219 __EOF__
220 expected_out => '' );
221
222 #------------------------------------------------------------------------------
223 BUnit::run(name => 'crossref_map_err_24',
224 resource => 'crossref.map {{abc} def xyz}',
225 expected_err => <<__EOF__,
226
227 {abc} def xyz
228 _____________^
229 *** BibTool ERROR: Symbol expected.
230 __EOF__
231 expected_out => '' );
232
233 #------------------------------------------------------------------------------
234 BUnit::run(name => 'crossref_map_err_25',
235 resource => 'crossref.map {{abc} def {xyz}}',
236 expected_err => <<__EOF__,
237
238 {abc} def {xyz}
239 _______________^
240 *** BibTool ERROR: Symbol expected.
241 __EOF__
242 expected_out => '' );
243
244 #------------------------------------------------------------------------------
245 BUnit::run(name => 'crossref_map_err_30',
246 resource => 'crossref.map {{abc} def {xyz} ghi}',
247 expected_err => <<__EOF__,
248
249 *** BibTool WARNING: Unknown source entry type \`abc\'. Mapping ignored.
250 __EOF__
251 expected_out => '' );
252
253 #------------------------------------------------------------------------------
254 BUnit::run(name => 'crossref_map_err_31',
255 resource => 'crossref.map {{book} def {xyz} ghi}',
256 expected_err => <<__EOF__,
257
258 *** BibTool WARNING: Unknown destination entry type \`xyz\'. Mapping ignored.
259 __EOF__
260 expected_out => '' );
261
262 #------------------------------------------------------------------------------
263 BUnit::run(name => 'crossref_map_1',
264 resource => <<__EOF__,
265 crossref.map {{book} # def = {article} ttt}
266 expand.crossref=true
267 __EOF__
268 bib => <<__EOF__,
269 \@Manual{ bibtool,
270 title = {BibTool},
271 crossref = {x}
272 }
273 \@Book{ x,
274 title = {BibTool},
275 author = {Gerd Neugebauer}
276 }
277 __EOF__
278 expected_out => <<__EOF__,
279
280 \@Manual{ bibtool,
281 title = {BibTool},
282 author = {Gerd Neugebauer}
283 }
284
285 \@Book{ x,
286 title = {BibTool},
287 author = {Gerd Neugebauer}
288 }
289 __EOF__
290 expected_err => '' );
291
292 #------------------------------------------------------------------------------
293 BUnit::run(name => 'crossref_map_2',
294 resource => <<__EOF__,
295 crossref.map {{book} \# title = {manual} booktitle}
296 expand.crossref=true
297 __EOF__
298 bib => <<__EOF__,
299 \@Manual{ bibtool,
300 crossref = {x}
301 }
302 \@Book{ x,
303 title = {BibTool},
304 author = {Gerd Neugebauer}
305 }
306 __EOF__
307 expected_out => <<__EOF__,
308
309 \@Manual{ bibtool,
310 booktitle = {BibTool},
311 author = {Gerd Neugebauer}
312 }
313
314 \@Book{ x,
315 title = {BibTool},
316 author = {Gerd Neugebauer}
317 }
318 __EOF__
319 expected_err => '' );
320
321 1;
322 #------------------------------------------------------------------------------
323 # Local Variables:
324 # mode: perl
325 # End: