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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
|
use strict;
use warnings;
use utf8;
no warnings 'utf8';
use Test::More tests => 20;
use Biber;
use Biber::Output::BBL;
use Log::Log4perl qw(:easy);
Log::Log4perl->easy_init($ERROR);
chdir("t/tdata") ;
# Set up Biber object
my $biber = Biber->new(noconf => 1);
$biber->parse_ctrlfile('crossrefs.bcf');
$biber->set_output_obj(Biber::Output::BBL->new());
# Options - we could set these in the control file but it's nice to see what we're
# relying on here for tests
# Biber options
Biber::Config->setoption('fastsort', 1);
# Now generate the information
$biber->prepare;
my $section0 = $biber->sections->get_section(0);
my $main0 = $section0->get_list('MAIN');
my $section1 = $biber->sections->get_section(1);
my $main1 = $section1->get_list('MAIN');
my $out = $biber->get_output_obj;
# crossref field is included as the parent is included by being crossrefed >= mincrossrefs times
my $cr1 = q| \entry{cr1}{inbook}{}
\name{labelname}{1}{%
{{Gullam}{G.}{Graham}{G.}{}{}{}{}}%
}
\name{author}{1}{%
{{Gullam}{G.}{Graham}{G.}{}{}{}{}}%
}
\name{editor}{1}{%
{{Erbriss}{E.}{Edgar}{E.}{}{}{}{}}%
}
\list{publisher}{1}{%
{Grimble}%
}
\strng{namehash}{GG1}
\strng{fullhash}{GG1}
\field{sortinit}{G}
\field{labelyear}{1974}
\field{booktitle}{Graphs of the Continent}
\strng{crossref}{crm}
\field{eprintclass}{SOMECLASS}
\field{eprinttype}{SomEPrFiX}
\field{origyear}{1955}
\field{title}{Great and Good Graphs}
\field{year}{1974}
\endentry
|;
# crossref field is included as the parent is included by being crossrefed >= mincrossrefs times
my $cr2 = q| \entry{cr2}{inbook}{}
\name{labelname}{1}{%
{{Fumble}{F.}{Frederick}{F.}{}{}{}{}}%
}
\name{author}{1}{%
{{Fumble}{F.}{Frederick}{F.}{}{}{}{}}%
}
\name{editor}{1}{%
{{Erbriss}{E.}{Edgar}{E.}{}{}{}{}}%
}
\list{institution}{1}{%
{Institution}%
}
\list{publisher}{1}{%
{Grimble}%
}
\strng{namehash}{FF1}
\strng{fullhash}{FF1}
\field{sortinit}{F}
\field{labelyear}{1974}
\field{booktitle}{Graphs of the Continent}
\strng{crossref}{crm}
\field{origyear}{1943}
\field{title}{Fabulous Fourier Forms}
\field{year}{1974}
\warn{\item Field 'school' is aliased to field 'institution' but both are defined in entry with key 'cr2' - skipping field 'school'}
\endentry
|;
# This is included as it is crossrefed >= mincrossrefs times
# Notice lack of labelname and hashes because the only name is EDITOR and useeditor is false
my $crm = q| \entry{crm}{book}{}
\name{editor}{1}{%
{{Erbriss}{E.}{Edgar}{E.}{}{}{}{}}%
}
\list{publisher}{1}{%
{Grimble}%
}
\strng{namehash}{1}
\strng{fullhash}{1}
\field{sortinit}{G}
\field{labelyear}{1974}
\field{title}{Graphs of the Continent}
\field{year}{1974}
\endentry
|;
# crossref field is included as the parent is cited
my $cr3 = q| \entry{cr3}{inbook}{}
\name{labelname}{1}{%
{{Aptitude}{A.}{Arthur}{A.}{}{}{}{}}%
}
\name{author}{1}{%
{{Aptitude}{A.}{Arthur}{A.}{}{}{}{}}%
}
\name{editor}{1}{%
{{Monkley}{M.}{Mark}{M.}{}{}{}{}}%
}
\list{publisher}{1}{%
{Rancour}%
}
\strng{namehash}{AA1}
\strng{fullhash}{AA1}
\field{sortinit}{A}
\field{labelyear}{1996}
\field{booktitle}{Beasts of the Burbling Burns}
\strng{crossref}{crt}
\field{eprinttype}{sometype}
\field{origyear}{1934}
\field{title}{Arrangements of All Articles}
\field{year}{1996}
\warn{\item Field 'archiveprefix' is aliased to field 'eprinttype' but both are defined in entry with key 'cr3' - skipping field 'archiveprefix'}
\endentry
|;
# cited as normal
my $crt = q| \entry{crt}{book}{}
\name{editor}{1}{%
{{Monkley}{M.}{Mark}{M.}{}{}{}{}}%
}
\list{publisher}{1}{%
{Rancour}%
}
\strng{namehash}{1}
\strng{fullhash}{1}
\field{sortinit}{B}
\field{labelyear}{1996}
\field{title}{Beasts of the Burbling Burns}
\field{year}{1996}
\endentry
|;
# various event fields inherited correctly
my $cr6 = q| \entry{cr6}{inproceedings}{}
\name{labelname}{1}{%
{{Author}{A.}{Firstname}{F.}{}{}{}{}}%
}
\name{author}{1}{%
{{Author}{A.}{Firstname}{F.}{}{}{}{}}%
}
\name{editor}{1}{%
{{Editor}{E.}{}{}{}{}{}{}}%
}
\list{location}{1}{%
{Address}%
}
\strng{namehash}{AF1}
\strng{fullhash}{AF1}
\field{sortinit}{A}
\field{labelyear}{2009}
\field{booktitle}{Manual booktitle}
\field{eventday}{21}
\field{eventendday}{24}
\field{eventendmonth}{08}
\field{eventendyear}{2009}
\field{eventmonth}{08}
\field{eventtitle}{Title of the event}
\field{eventyear}{2009}
\field{title}{Title of inproceeding}
\field{venue}{Location of event}
\field{year}{2009}
\field{pages}{123\bibrangedash}
\endentry
|;
# Special fields inherited correctly
my $cr7 = q| \entry{cr7}{inbook}{}
\name{labelname}{1}{%
{{Author}{A.}{Firstname}{F.}{}{}{}{}}%
}
\name{author}{1}{%
{{Author}{A.}{Firstname}{F.}{}{}{}{}}%
}
\name{bookauthor}{1}{%
{{Bookauthor}{B.}{Brian}{B.}{}{}{}{}}%
}
\list{publisher}{1}{%
{Publisher of proceeding}%
}
\strng{namehash}{AF1}
\strng{fullhash}{AF1}
\field{sortinit}{A}
\field{labelyear}{2010}
\field{booksubtitle}{Book Subtitle}
\field{booktitle}{Book Title}
\field{booktitleaddon}{Book Titleaddon}
\field{title}{Title of Book bit}
\field{year}{2010}
\field{pages}{123\bibrangedash 126}
\verb{verbb}
\verb String
\endverb
\endentry
|;
# Default inheritance supressed except for specified
my $cr8 = q| \entry{cr8}{incollection}{}
\name{labelname}{1}{%
{{Smith}{S.}{Firstname}{F.}{}{}{}{}}%
}
\name{author}{1}{%
{{Smith}{S.}{Firstname}{F.}{}{}{}{}}%
}
\strng{namehash}{SF1}
\strng{fullhash}{SF1}
\field{sortinit}{S}
\field{labelyear}{2010}
\field{booktitle}{Book Title}
\field{title}{Title of Collection bit}
\field{year}{2010}
\field{pages}{1\bibrangedash 12}
\endentry
|;
# xref field is included as the parent is included by being crossrefed >= mincrossrefs times
my $xr1 = q| \entry{xr1}{inbook}{}
\name{labelname}{1}{%
{{Zentrum}{Z.}{Zoe}{Z.}{}{}{}{}}%
}
\name{author}{1}{%
{{Zentrum}{Z.}{Zoe}{Z.}{}{}{}{}}%
}
\strng{namehash}{ZZ1}
\strng{fullhash}{ZZ1}
\field{sortinit}{Z}
\field{origyear}{1921}
\field{title}{Moods Mildly Modified}
\strng{xref}{xrm}
\endentry
|;
# xref field is included as the parent is included by being crossrefed >= mincrossrefs times
my $xr2 = q| \entry{xr2}{inbook}{}
\name{labelname}{1}{%
{{Instant}{I.}{Ian}{I.}{}{}{}{}}%
}
\name{author}{1}{%
{{Instant}{I.}{Ian}{I.}{}{}{}{}}%
}
\strng{namehash}{II1}
\strng{fullhash}{II1}
\field{sortinit}{I}
\field{origyear}{1926}
\field{title}{Migraines Multiplying Madly}
\strng{xref}{xrm}
\endentry
|;
# This is included as it is crossrefed >= mincrossrefs times
# Notice lack of labelname and hashes because the only name is EDITOR and useeditor is false
my $xrm = q| \entry{xrm}{book}{}
\name{editor}{1}{%
{{Prendergast}{P.}{Peter}{P.}{}{}{}{}}%
}
\list{publisher}{1}{%
{Mainstream}%
}
\strng{namehash}{1}
\strng{fullhash}{1}
\field{sortinit}{C}
\field{labelyear}{1970}
\field{title}{Calligraphy, Calisthenics, Culture}
\field{year}{1970}
\endentry
|;
# xref field is included as the parent is cited
my $xr3 = q| \entry{xr3}{inbook}{}
\name{labelname}{1}{%
{{Normal}{N.}{Norman}{N.}{}{}{}{}}%
}
\name{author}{1}{%
{{Normal}{N.}{Norman}{N.}{}{}{}{}}%
}
\strng{namehash}{NN1}
\strng{fullhash}{NN1}
\field{sortinit}{N}
\field{origyear}{1923}
\field{title}{Russion Regalia Revisited}
\strng{xref}{xrt}
\endentry
|;
# cited as normal
my $xrt = q| \entry{xrt}{book}{}
\name{editor}{1}{%
{{Lunders}{L.}{Lucy}{L.}{}{}{}{}}%
}
\list{publisher}{1}{%
{Middling}%
}
\strng{namehash}{1}
\strng{fullhash}{1}
\field{sortinit}{K}
\field{labelyear}{1977}
\field{title}{Kings, Cork and Calculation}
\field{year}{1977}
\endentry
|;
# No crossref field as parent is not cited (mincrossrefs < 2)
my $cr4 = q| \entry{cr4}{inbook}{}
\name{labelname}{1}{%
{{Mumble}{M.}{Morris}{M.}{}{}{}{}}%
}
\name{author}{1}{%
{{Mumble}{M.}{Morris}{M.}{}{}{}{}}%
}
\name{editor}{1}{%
{{Jermain}{J.}{Jeremy}{J.}{}{}{}{}}%
}
\list{publisher}{1}{%
{Pillsbury}%
}
\strng{namehash}{MM1}
\strng{fullhash}{MM1}
\field{sortinit}{M}
\field{labelyear}{1945}
\field{booktitle}{Vanquished, Victor, Vandal}
\field{origyear}{1911}
\field{title}{Enterprising Entities}
\field{year}{1945}
\endentry
|;
# No crossref field as parent is not cited (mincrossrefs < 2)
my $xr4 = q| \entry{xr4}{inbook}{}
\name{labelname}{1}{%
{{Mistrel}{M.}{Megan}{M.}{}{}{}{}}%
}
\name{author}{1}{%
{{Mistrel}{M.}{Megan}{M.}{}{}{}{}}%
}
\strng{namehash}{MM2}
\strng{fullhash}{MM2}
\field{sortinit}{M}
\field{origyear}{1933}
\field{title}{Lumbering Lunatics}
\endentry
|;
# Missing keys in xref/crossref should be deleted during datasource parse
# So these two should have no xref/crossref data in them
my $mxr = q| \entry{mxr}{inbook}{}
\name{labelname}{1}{%
{{Mistrel}{M.}{Megan}{M.}{}{}{}{}}%
}
\name{author}{1}{%
{{Mistrel}{M.}{Megan}{M.}{}{}{}{}}%
}
\strng{namehash}{MM2}
\strng{fullhash}{MM2}
\field{sortinit}{M}
\field{origyear}{1933}
\field{title}{Lumbering Lunatics}
\endentry
|;
my $mcr = q| \entry{mcr}{inbook}{}
\name{labelname}{1}{%
{{Mistrel}{M.}{Megan}{M.}{}{}{}{}}%
}
\name{author}{1}{%
{{Mistrel}{M.}{Megan}{M.}{}{}{}{}}%
}
\strng{namehash}{MM2}
\strng{fullhash}{MM2}
\field{sortinit}{M}
\field{origyear}{1933}
\field{title}{Lumbering Lunatics}
\endentry
|;
is($out->get_output_entry($main0,'cr1'), $cr1, 'crossref test 1');
is($out->get_output_entry($main0,'cr2'), $cr2, 'crossref test 2');
is($out->get_output_entry($main0,'crm'), $crm, 'crossref test 3');
is($out->get_output_entry($main0,'cr3'), $cr3, 'crossref test 4');
is($out->get_output_entry($main0,'crt'), $crt, 'crossref test 5');
is($out->get_output_entry($main0,'cr4'), $cr4, 'crossref test 6');
is($section0->has_citekey('crn'), 0,'crossref test 7');
is($out->get_output_entry($main0,'cr6'), $cr6, 'crossref test (inheritance) 8');
is($out->get_output_entry($main0,'cr7'), $cr7, 'crossref test (inheritance) 9');
is($out->get_output_entry($main0,'cr8'), $cr8, 'crossref test (inheritance) 10');
is($out->get_output_entry($main0,'xr1'), $xr1, 'xref test 1');
is($out->get_output_entry($main0,'xr2'), $xr2, 'xref test 2');
is($out->get_output_entry($main0,'xrm'), $xrm, 'xref test 3');
is($out->get_output_entry($main0,'xr3'), $xr3, 'xref test 4');
is($out->get_output_entry($main0,'xrt'), $xrt, 'xref test 5');
is($out->get_output_entry($main0,'xr4'), $xr4, 'xref test 6');
is($section0->has_citekey('xrn'), 0,'xref test 7');
is($out->get_output_entry($main0,'mxr'), $mxr, 'missing xref test');
is($out->get_output_entry($main0,'mcr'), $mcr, 'missing crossef test');
is($section1->has_citekey('crn'), 0,'mincrossrefs reset between sections');
unlink <*.utf8>;
|