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
|
#!/usr/bin/perl
use Test::More tests => 8;
use strict;
use IO::File;
use BibTeX::Parser;
my $fh = IO::File->new("t/bibs/english.bib");
my $parser = new BibTeX::Parser $fh;
my $count = 0;
my $entry = $parser->next;
is($entry->parse_ok, 0, "Ignore spurious @ before parenthesis");
$entry = $parser->next;
is($entry->parse_ok, 0, "Ignore spurious @ in email address");
$entry = $parser->next;
is(scalar $entry->author, 1, "# authors");
#@BOOK{Carey,
# AUTHOR="G. V. Carey",
is($entry->field("title"), "Mind the Stop: A Brief Guide to Punctuation", "title");
is($entry->field("publisher"), "Penguin", "publisher");
is($entry->field("year"), 1958, "year");
$count++;
while ($entry = $parser->next) {
$count++;
if ($count == 8) {
is( scalar $entry->author, 4, 'Last entry has 4 authors');
}
}
is($count, 8, "number of entries");
|