diff options
Diffstat (limited to 'Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t')
25 files changed, 920 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/00-load.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/00-load.t new file mode 100644 index 00000000000..9862dc79865 --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/00-load.t @@ -0,0 +1,11 @@ +#!/usr/bin/perl -w + +use Test::More tests => 3; + +BEGIN { + use_ok( 'BibTeX::Parser' ); + use_ok( 'BibTeX::Parser::Author' ); + use_ok( 'BibTeX::Parser::Entry' ); +} + +diag( "Testing BibTeX::Parser $BibTeX::Parser::VERSION, Perl $], $^X" ); diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/01-parse.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/01-parse.t new file mode 100644 index 00000000000..70e298d4be2 --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/01-parse.t @@ -0,0 +1,36 @@ +#!/usr/bin/perl -w + +use Test::More tests => 11; + +use BibTeX::Parser; +use IO::File; + +use constant ENTRIES => 1; + +my $fh = new IO::File "t/bibs/01.bib", "r" ; + +if (defined $fh) { + my $parser = new BibTeX::Parser $fh; + + isa_ok($parser, "BibTeX::Parser"); + + my $count = 0; + + while (my $entry = $parser->next) { + $count++; + isa_ok($entry, "BibTeX::Parser::Entry"); + is($entry->key, "key01", "key"); + is($entry->type, "ARTICLE", "type"); + ok($entry->parse_ok, "parse_ok"); + is($entry->field("year"), 1950, "field"); + is($entry->field("month"), "January~1", "field"); + + my @authors = $entry->author; + is(scalar @authors, 2, "#authors"); + isa_ok($authors[0], "BibTeX::Parser::Author"); + is("$authors[0]", "Duck, Donald", "correct author"); + } + + is($count, ENTRIES, "number of entries"); +} + diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/02-parse_string.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/02-parse_string.t new file mode 100644 index 00000000000..90b87eba14c --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/02-parse_string.t @@ -0,0 +1,39 @@ +#!/usr/bin/perl -w + +use Test::More tests => 7; + +use BibTeX::Parser; + +my %strings = (); + +$_ = 1234; +parse_ok("parse digit string"); + +$_ = '"simple double quoted string"'; +parse_is("simple double quoted string", "- double quoted string"); + +$_ = '"double quotes { with embeded } brackets"'; +parse_is("double quotes { with embeded } brackets", "- with embeded brackets"); + +$_ = '"string 1 " # "string 2"'; +parse_is("string 1 string 2", "- concatenation"); + +$strings{test} = "string"; +$strings{other} = "text"; + +$_ = "test"; +parse_is("string", "- string variable"); + +$_ = "test # other"; +parse_is("stringtext", "- concatenation of string variables"); + +$_ = '"M{\"{u}}nchen"'; +parse_is('M{\"{u}}nchen', "- escaped quote"); + +sub parse_ok { + is(BibTeX::Parser::_parse_string(\%strings), $_, shift); +} + +sub parse_is { + is(BibTeX::Parser::_parse_string(\%strings), shift, shift); +} diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/03-parse_entry.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/03-parse_entry.t new file mode 100644 index 00000000000..92597173a94 --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/03-parse_entry.t @@ -0,0 +1,61 @@ +#!/usr/bin/perl -w + +use Test::More tests => 2; + +use IO::String; +use BibTeX::Parser; + +{ + my $string = q|@article{lin1973, + author = "Shen Lin and Brian W. Kernighan", + title = "An Effective Heuristic Algorithm for the Travelling-Salesman Problem", + journal = "Operations Research", + volume = 21, + year = 1973, + pages = "498--516" + }|; + my $fh = IO::String->new($string); + + my $parser = BibTeX::Parser->new( $fh ); + +#my @result = BibTeX::Parser->_parse($fh); + + my $entry = $parser->next; + + is_deeply($entry, {_type => 'ARTICLE', _key => 'lin1973', author => "Shen Lin and Brian W. Kernighan", + title => "An Effective Heuristic Algorithm for the Travelling-Salesman Problem", + journal => "Operations Research", + volume => 21, + year => 1973, + pages => "498--516", _parse_ok => 1, + _raw => $string}, "parse \@ARTICLE"); + +} +{ + my $string = q|@InProceedings{Herper:2001:MVS, + author = {Henry Herper}, + title = {{M}odellierung von {S}ystemen: ein + {A}pplikationsgebiet im {I}nformatikunterricht}, + booktitle = {Informatikunterricht und Medienbildung, INFOS 2001 + (9. Fachtagung Informatik und Schule, Paderborn + 17.-20- September 2001) -- Tagungsband}, + editor = {Reinhard Keil-Slavik and Johannes Magenheim}, + year = {2001}, +}|; + my $fh = IO::String->new($string); + + my $parser = BibTeX::Parser->new( $fh ); + + my $entry = $parser->next; + + is_deeply($entry, { + _type => 'INPROCEEDINGS', + _key => 'Herper:2001:MVS', + author => "Henry Herper", + title => "{M}odellierung von {S}ystemen: ein {A}pplikationsgebiet im {I}nformatikunterricht", + booktitle => "Informatikunterricht und Medienbildung, INFOS 2001 (9. Fachtagung Informatik und Schule, Paderborn 17.-20- September 2001) -- Tagungsband", + editor => "Reinhard Keil-Slavik and Johannes Magenheim", + year => 2001, + _parse_ok => 1, + _raw => $string}, "parse \@ARTICLE"); +} diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/04-entry.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/04-entry.t new file mode 100644 index 00000000000..3ca9797011d --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/04-entry.t @@ -0,0 +1,42 @@ +#!/usr/bin/perl -w + +use Test::More tests => 13; + +use BibTeX::Parser::Entry; + + +my $entry = new BibTeX::Parser::Entry("type", "key", 1, {title => "title"}); + +isa_ok($entry, "BibTeX::Parser::Entry"); + +is($entry->type, "TYPE", "Entry::type get"); + +$entry->type("newtype"); + +is($entry->type, "NEWTYPE", "Entry::type set"); + +is($entry->key, "key", "Entry::key get"); + +$entry->key("newkey"); + +is($entry->key, "newkey", "Entry::key set"); + +is($entry->field("title"), "title", "Entry::field with new"); + +$entry->field("title" => "newtitle"); + +is($entry->field("title"), "newtitle", "Entry::field overwrite"); + +$entry->field("year" => 2008); + +is($entry->field("year"), 2008, "Entry::field set"); + +is($entry->field("pages"), undef, "Entry::field undef on unknown value"); + +is($entry->fieldlist, 2, "size of fieldlist"); + +ok($entry->has("title"), "Entry::has true on known value"); + +ok($entry->has("year"), "Entry::has true on known value"); + +ok( ! $entry->has("pages"), "Entry::has false on unknown value"); diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/05-author.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/05-author.t new file mode 100644 index 00000000000..cae7824099e --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/05-author.t @@ -0,0 +1,68 @@ +#!/usr/bin/perl + +use Test::More; + +use BibTeX::Parser::Author; + +# Names from Mittelbach, Goossens: The LaTeX Companion, Second Edition. +my %names = ( + "Donald E. Knuth" => ["Donald E.", undef, "Knuth", undef], + "John Chris Smith" => ["John Chris", undef, "Smith", undef], + "Smith, John Chris" => ["John Chris", undef, "Smith", undef], + "Thomas von Neumann" => ["Thomas", "von", "Neumann", undef], + "von Neumann, Thomas" => ["Thomas", "von", "Neumann", undef], + "Lopez Fernandez, Miguel" => ["Miguel", undef, "Lopez Fernandez", undef], + "Pierre de la Porte" => ["Pierre", "de la", "Porte", undef], + "Smith, Jr., Robert" => ["Robert", undef, "Smith", "Jr."], + "von Smith, Jr., Robert" => ["Robert", "von", "Smith", "Jr."], + "Johannes Martinus Albertus van de Groene Heide" => ["Johannes Martinus Albertus", "van de", "Groene Heide", undef], + "Maria-Victoria Delgrande" => ["Maria-Victoria", undef, "Delgrande", undef], + "Anonymous" => [undef, undef, "Anonymous", undef], + "von Neumann" => [undef, "von", "Neumann", undef], + "N. Tetteh-Lartey" => ["N.", undef, "Tetteh-Lartey", undef], + "von Tetteh-Lartey, N." => ["N.", "von", "Tetteh-Lartey", undef], + "von Tetteh-Lartey, Jr., N." => ["N.", "von", "Tetteh-Lartey", "Jr."], + "" => [undef, undef, undef, undef], + " " => [undef, undef, undef, undef], + "\n" => [undef, undef, undef, undef], + "al." => [undef, undef, "al.", undef], + "et. al." => [undef, undef, "et. al.", undef], + "O'Malley, A." => ["A.", undef, "O'Malley", undef], + "A. O'Malley" => ["A.", undef, "O'Malley", undef], + "Arthur O'Malley" => ["Arthur", undef, "O'Malley", undef], + "O'Malley, Arthur" => ["Arthur", undef, "O'Malley", undef], + 'L.M. M\"uller' => ["L.M.", undef, 'M\"uller', undef], + 'M\"uller, L.M.' => ["L.M.", undef, 'M\"uller', undef], + 'L.M. M"uller' => ["L.M.", undef, 'M"uller', undef], + 'M"uller, L.M.' => ["L.M.", undef, 'M"uller', undef], + 'van Beethoven, Ludwig' => ["Ludwig", "van", "Beethoven", undef ], + '{Barnes and Noble, Inc.}' => [undef, undef, 'Barnes and Noble, Inc.', undef], + "Ludwigg {van Beethoven}" => ["Ludwigg", undef, "van Beethoven", undef], + '{van Beethoven}, Ludwig' => ["Ludwig", undef, "van Beethoven", undef ], +); + +plan tests => (keys(%names) * 6 + 5); + +my $author = new BibTeX::Parser::Author; + +isa_ok($author, "BibTeX::Parser::Author", "Correct type"); + +is($author->first, undef, "Initial state 'first'"); +is($author->von, undef, "Initial state 'von'"); +is($author->last, undef, "Initial state 'last'"); +is($author->jr, undef, "Initial state 'jr'"); + + +foreach my $name (keys %names) { + + is_deeply([BibTeX::Parser::Author->split($name)], $names{$name}, $name =~ /\w/ ? $name : "whitespace name: '$name'" ); + + $author = new BibTeX::Parser::Author $name; + + isa_ok($author, "BibTeX::Parser::Author"); + + is($author->first, $names{$name}->[0] ); + is($author->von, $names{$name}->[1]); + is($author->last, $names{$name}->[2]); + is($author->jr, $names{$name}->[3]); +} diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/06-parse_complex.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/06-parse_complex.t new file mode 100644 index 00000000000..95a5848a717 --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/06-parse_complex.t @@ -0,0 +1,46 @@ +#!/usr/bin/perl + +use Test::More tests => 19; + +use strict; +use IO::File; +use BibTeX::Parser; + +my $fh = IO::File->new("t/bibs/06.bib"); + +my $parser = new BibTeX::Parser $fh; + + +my $entry = $parser->next; + +isa_ok($entry, 'BibTeX::Parser::Entry', "Correct type"); +ok($entry->parse_ok, "Entry parsed correctly"); +is($entry->type, "ARTICLE", "BibTeX type is correct"); +is($entry->field("title"), "Paper title", "Title attribute"); +is($entry->field("year"), 2008); +is($entry->field("month"), "August", "Month expansion"); +is($entry->key, 'key1', "key"); + +my @authors = $entry->author; +is(scalar @authors, 2, "number of authors correct"); +my $author = shift @authors; +is_deeply( + [$author->first, $author->von, $author->last, $author->jr], + ['Gerhard', undef, 'Gossen', undef], "author correct"); + +$author = shift @authors; +is_deeply( + [$author->first, $author->von, $author->last, $author->jr], + ['Ludwig', 'van', 'Beethoven', undef], "author correct"); + +$entry = $parser->next; +isa_ok($entry, 'BibTeX::Parser::Entry', "Correct type"); +ok($entry->parse_ok, "Entry parsed correctly"); +is($entry->type, "BOOK", "BibTeX type is correct"); +is($entry->field("title"), "Book title", "Title attribute"); +is($entry->field("year"), 2008); +is($entry->field("month"), "August", "Month expansion"); +is($entry->key, 'key2', "key"); +@authors = $entry->author; +is(scalar @authors, 1, "number of authors"); +is(scalar $entry->editor, 0, "number of editors"); diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/07-parse_englishbib.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/07-parse_englishbib.t new file mode 100644 index 00000000000..3348a55248f --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/07-parse_englishbib.t @@ -0,0 +1,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"); diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/08-parse_large.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/08-parse_large.t new file mode 100644 index 00000000000..5375d9a0620 --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/08-parse_large.t @@ -0,0 +1,24 @@ +#!/usr/bin/perl -w + +use Test::More skip_all => "Performance test", tests => 1; + +use IO::File; +use BibTeX::Parser; + +my $starttime = time; + +my $fh = IO::File->new('t/bibs/java.bib'); #cl-nlp8x.bib'); + +my $parser = new BibTeX::Parser $fh; +my $entries = 0; + +#my @result = BibTeX::Parser->_parse($fh); + +while(my $entry = $parser->next) { + $entries++; +} + +my $parsetime = time - $starttime; + +warn "Parsed $entries entries in $parsetime seconds"; +ok(1, "Parsed $entries entries in $parsetime seconds"); diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/09-complex.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/09-complex.t new file mode 100644 index 00000000000..eff8f751b29 --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/09-complex.t @@ -0,0 +1,37 @@ +#!/usr/bin/perl -w + +use Test::More tests => 1; + +use IO::File; +use BibTeX::Parser; + + +my $fh = IO::File->new('t/bibs/09-complex.bib'); + +my $parser = new BibTeX::Parser $fh; + +#my @result = BibTeX::Parser->_parse($fh); + +my $entry = $parser->next; + +is_deeply($entry, {_type => 'ARTICLE', _key => 'Ahrenberg88', + author => "L. Ahrenberg and A. Jonsson", + title => "An interactive system for tagging dialogues", + journal => 'Literary \& Linguistic Computing', + volume => 3, + number => "2", + pages => "66--70", + year => "1988", + keywords => "conver", + _parse_ok => 1, + _raw => '@Article{Ahrenberg88, + author = "L. Ahrenberg and A. Jonsson", + title = "An interactive system for tagging dialogues", + journal = "Literary \& Linguistic Computing", + volume = "3", + number = "2", + pages = "66--70", + year = "1988", + keywords = "conver", +}' + }, "parse \@ARTICLE"); diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/10-funnyname.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/10-funnyname.t new file mode 100644 index 00000000000..1d21a2ea093 --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/10-funnyname.t @@ -0,0 +1,56 @@ +#!/usr/bin/perl -w + +use Test::More tests => 11; + +use IO::File; +use BibTeX::Parser; + +my $fh = IO::File->new('t/bibs/10-funnyname.bib'); + +my $parser = BibTeX::Parser->new($fh); + +#my @result = BibTeX::Parser->_parse($fh); + +my $entry = $parser->next; + +is_deeply( + $entry, + { + _type => 'ARTICLE', + _key => 'testkey', + author => 'A. Bar and L.M. M\"uller', + title => 'foo', + journal => 'journal', + volume => 1, + number => 1, + pages => 1, + year => 2008, + _parse_ok => 1, + _raw => '@article{testkey, + year = {2008}, + title = "foo", + author = {A. Bar and L.M. M\"uller}, + journal = {journal}, + volume = {1}, + number = {1}, + pages = {1}, +}', + }, + "parse \@ARTICLE" +); + +my @authors = $entry->author; + +pass("->author didn't loop forever"); +ok(@authors == 2, "Two authors"); + +is($authors[0]->first, 'A.', "A1 first name"); +is($authors[0]->last, 'Bar', "A1 last name"); +ok(!$authors[0]->von, "A1 no 'von'"); +ok(!$authors[0]->jr, "A1 no 'jr'"); + +is($authors[1]->first, 'L.M.', "A2 first name"); +is($authors[1]->last, 'M\"uller', "A2 last name"); +ok(!$authors[1]->von, "A2 no 'von'"); +ok(!$authors[1]->jr, "A2 no 'jr'"); + diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/01.bib b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/01.bib new file mode 100644 index 00000000000..eb12c43c200 --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/01.bib @@ -0,0 +1,6 @@ +@ARTICLE{key01, + year = 1950, + author = {Donald Duck and Someone Else}, + title = {Title text}, + month = jan # "~1" +} diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/06.bib b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/06.bib new file mode 100644 index 00000000000..242ae662cc6 --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/06.bib @@ -0,0 +1,27 @@ +this is text, which is ignored by bibtex. + +@PREAMBLE{ + This is only used for BibTeX files used in LaTeX documents +} + +@Comment{ + Comments are ignored too. +} + +@ARTICLE{key1, + author = {Gerhard Gossen and Ludwig van Beethoven}, + title = "Paper title", + year = 2008, + month = aug, +} + +@STRING{ gerhard = "Gerhard" } + +@STRING{ gossen = "Gossen" } + +@BOOK{ key2, + author = gerhard # " " # gossen, + title = "Book title", + year = "2008", + month = aug, +} diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/09-complex.bib b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/09-complex.bib new file mode 100644 index 00000000000..cacf3227230 --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/09-complex.bib @@ -0,0 +1,11 @@ +@Article{Ahrenberg88, + author = "L. Ahrenberg and A. Jonsson", + title = "An interactive system for tagging dialogues", + journal = "Literary \& Linguistic Computing", + volume = "3", + number = "2", + pages = "66--70", + year = "1988", + keywords = "conver", +} + diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/10-funnyname.bib b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/10-funnyname.bib new file mode 100644 index 00000000000..050fbc05348 --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/10-funnyname.bib @@ -0,0 +1,10 @@ +@article{testkey, + year = {2008}, + title = "foo", + author = {A. Bar and L.M. M\"uller}, + journal = {journal}, + volume = {1}, + number = {1}, + pages = {1}, +} + diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/endnote.txt b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/endnote.txt new file mode 100644 index 00000000000..b15f5f2e0de --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/endnote.txt @@ -0,0 +1,6 @@ +@article{ + volume = {59}, + number = {6}, + year = {1999} +} + diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/engineering_village.txt b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/engineering_village.txt new file mode 100644 index 00000000000..256f5a853da --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/engineering_village.txt @@ -0,0 +1,24 @@ +@inproceedings{1997493856789 , +language = {English}, +year = {1997}, +} + + +@inproceedings{1998043944915 , +language = {English}, +year = {1997}, +} + + +@article{2003137419501 , +language = {English}, +year = {2002}, +} + + +@inproceedings{2002367072517 , +language = {English}, +year = {2002}, +} + + diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/english.bib b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/english.bib new file mode 100644 index 00000000000..6893e1e4111 --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/english.bib @@ -0,0 +1,55 @@ +$Id: english.bib,v 1.1.1.1 2015/10/25 01:25:20 boris Exp $ + +Please notify Adrian F Clark <alien@uk.ac.essex.ese> of any additions +or corrections to this list. + +@BOOK{Carey, + AUTHOR="G. V. Carey", + TITLE="Mind the Stop: A Brief Guide to Punctuation", + PUBLISHER="Penguin", YEAR="1958"} + +@BOOK{Cooper, + AUTHOR="Bruce M. Cooper", + TITLE="Writing Technical Reports", + PUBLISHER="Penguin", YEAR="1964"} + +@BOOK{Fowler-ModernEnglish, + AUTHOR="H. W. Fowler", + TITLE="[A Dictionary of] Modern {E}nglish Usage", + PUBLISHER="Oxford University Press", + EDITION="2", YEAR="1965"} + (but first published in 1926) + +@BOOK{Fowler-KingsEnglish, + AUTHOR="H. W. Fowler and F. G. Fowler", + TITLE="The {K}ing's {E}nglish", + PUBLISHER="Oxford University Press", + EDITION="3", YEAR="1931"} + (but first published in 1906) + +@BOOK{Gowers, + AUTHOR="Sir Ernest Gowers", + TITLE="The Complete Plain Words", + PUBLISHER="Penguin", YEAR="1954"} + (but first published by HMSO) + +@BOOK{Hart, + AUTHOR="Horace Hart", + TITLE="[Hart's] Rules for Compositors and Readers + [at the Oxford University Press]", + PUBLISHER="Oxford University Press", + EDITION="39", YEAR="1983"} + (but first published in 1893) + +@BOOK{Partridge, + AUTHOR="Eric Partridge", + TITLE="Use and Abuse: a Guide to Good {E}nglish", + PUBLISHER="Hamish Hamilton", + EDITION="4", YEAR="1970"} + (but first published in 1947) + +@BOOK{Quirk-CompGram, + AUTHOR="Randolph Quirk and Sydney Greenbaum and Geoffrey Leach and + Jan Svartnik", + TITLE="A Comprehensive Grammar of the {E}nglish Language", + PUBLISHER="Longman", YEAR="1985"} diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/mathscinet.txt b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/mathscinet.txt new file mode 100644 index 00000000000..d46bd244e28 --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/mathscinet.txt @@ -0,0 +1,40 @@ +MathSciNet </mathscinet/index.html> + + * + Clipboard </mathscinet/clipboard.html> + * Home </mathscinet/index.html> + * Preferences </mathscinet/preferences.html> + * Help </mathscinet/help/headline_review_help_full.html> + * Support Mail </mathscinet/support_mail.html> + * Terms of Use </mathscinet/help/mathscinet_terms_of_use.html> + * University of Southampton + +@article {MR2254280, + VOLUME = {23}, + YEAR = {2006}, +} + + +@article {MR2254274, + VOLUME = {23}, + YEAR = {2006}, +} + + +@article {MR2248052, + VOLUME = {23}, + YEAR = {2006}, +} + + +*Matches:* 3 +Mirror Sites + + +© Copyright 2011, American Mathematical Society +<http://www.ams.org/ams/copyright.html> +Privacy Statement <http://www.ams.org/ams/privacy.html> +American Mathematical Society <http://www.ams.org> +American Mathematical Society +201 Charles Street +Providence, RI 02904-2294 diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bug66325.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bug66325.t new file mode 100644 index 00000000000..ac83b43aa97 --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bug66325.t @@ -0,0 +1,71 @@ +#!/usr/bin/perl -w + +use Test::More; + +use BibTeX::Parser; +use IO::File; + +{ + my $fh = new IO::File "t/bibs/endnote.txt", "r" ; + + if (defined $fh) { + my $parser = new BibTeX::Parser $fh; + + while (my $entry = $parser->next) { + isa_ok($entry, "BibTeX::Parser::Entry"); + ok($entry->parse_ok, "parse_ok"); + is($entry->key, undef, "key"); + is($entry->type, "ARTICLE", "type"); + is($entry->field("year"), 1999, "field"); + is($entry->field("volume"), 59, "first field"); + } + } +} + +{ + my $fh = new IO::File "t/bibs/mathscinet.txt", "r" ; + my @keys = qw(MR2254280 MR2254274 MR2248052); + + if (defined $fh) { + my $parser = new BibTeX::Parser $fh; + my $count = 0; + + while (my $entry = $parser->next) { + isa_ok($entry, "BibTeX::Parser::Entry"); + ok($entry->parse_ok, "parse_ok"); + is($entry->key, $keys[$count], "key"); + is($entry->type, "ARTICLE", "type"); + is($entry->field("volume"), 23, "first field"); + is($entry->field("year"), 2006, "field"); + $count++; + } + + is($count, 3, "number of entries"); + } +} + +{ + my $fh = new IO::File "t/bibs/engineering_village.txt", "r" ; + + my @types = qw( inproceedings inproceedings article inproceedings ); + my @keys = qw( 1997493856789 1998043944915 2003137419501 2002367072517 ); + my @years = qw( 1997 1997 2002 2002 ); + + if (defined $fh) { + my $parser = new BibTeX::Parser $fh; + my $count = 0; + + while (my $entry = $parser->next) { + isa_ok($entry, "BibTeX::Parser::Entry"); + ok($entry->parse_ok, "parse_ok"); + is($entry->key, $keys[$count], "key"); + is($entry->type, uc $types[$count], "type"); + is($entry->field("language"), "English", "first field"); + is($entry->field("year"), $years[$count], "field"); + $count++; + } + + is($count, 4, "number of entries"); + } +} +done_testing; diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/cleaned_field.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/cleaned_field.t new file mode 100644 index 00000000000..33a38784cd7 --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/cleaned_field.t @@ -0,0 +1,142 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use utf8; + +use Test::More; +use BibTeX::Parser::Entry; + +sub new_entry { + BibTeX::Parser::Entry->new( 'ARTICLE', 'Foo2010', 1, { @_ } ); +} +{ + my @german_tests = ( + [ '"a' => 'ä' ], + ['"`' => '„' ], + ["\"'" => '“' ], + ); + + foreach my $test ( @german_tests ) { + my $entry = new_entry( foo => $test->[0] ); + is( $entry->cleaned_field( 'foo', german => 1 ), $test->[1], "Convert $test->[0], german => 1" ); + } +} + +{ + binmode( DATA, ':utf8' ); + while (<DATA>) { + chomp; + my ( $tex, $result ) = split /\t/; + is( new_entry( foo => $tex )->cleaned_field( 'foo' ), $result, "Convert $tex" ); + } + close DATA; +} + +{ + my $entry_with_authors = new_entry( author => 'F{\"o}o Bar and B"ar, F.' ); + my @authors = $entry_with_authors->author; + is( scalar @authors, 2, "Number of authors is correct"); + is( $authors[0]->first, 'F{\"o}o', "non-cleaned version of first" ); + is( $authors[0]->last, 'Bar', "non-cleaned version of last" ); + + is( $authors[1]->first, 'F.', "non-cleaned version of first" ); + is( $authors[1]->last, 'B"ar', "non-cleaned version of last" ); + + my @clean_authors = $entry_with_authors->cleaned_author; + is( $clean_authors[0]->first, 'Föo', "cleaned version of first" ); + is( $clean_authors[0]->last, 'Bar', "cleaned version of last" ); + + is( $clean_authors[1]->first, 'F.', "cleaned version of first" ); + is( $clean_authors[1]->last, 'B"ar', "cleaned version of last" ); +} +done_testing; + +__DATA__ +\& & +{\`a} à +{\^a} â +{\~a} ã +{\'a} á +{\'{a}} á +{\"a} ä +{\`A} À +{\'A} Á +{\"A} Ä +{\aa} å +{\AA} Å +{\ae} æ +{\bf 12} 12 +{\'c} ć +{\cal P} P +{\c{c}} ç +{\c{C}} Ç +{\c{e}} ȩ +{\c{s}} ş +{\c{S}} Ş +{\c{t}} ţ +{\-d} d +{\`e} è +{\^e} ê +{\'e} é +{\"e} ë +{\'E} É +{\em bits} bits +{\H{o}} ő +{\`i} ì +{\^i} î +{\i} ı +{\`i} ì +{\'i} í +{\"i} ï +{\`\i} ì +{\'\i} í +{\"\i} ï +{\`{\i}} ì +{\'{\i}} í +{\"{\i}} ï +{\it Note} Note +{\k{e}} ę +{\l} ł +{\-l} l +{\log} log +{\~n} ñ +{\'n} ń +{\^o} ô +{\o} ø +{\'o} ó +{\"o} ö +{\"{o}} ö +{\'O} Ó +{\"O} Ö +{\"{O}} Ö +{\rm always} always +{\-s} s +{\'s} ś +{\sc JoiN} JoiN +{\sl bit\/ \bf 7} bit 7 +{\sl L'Informatique Nouvelle} L’Informatique Nouvelle +{\small and} and +{\ss} ß +{\TeX} TEX +{\TM} ™ +{\tt awk} awk +{\^u} û +{\'u} ú +{\"u} ü +{\"{u}} ü +{\'U} Ú +{\"U} Ü +{\u{a}} ă +{\u{g}} ğ +{\v{c}} č +{\v{C}} Č +{\v{e}} ě +{\v{n}} ň +{\v{r}} ř +{\v{s}} š +{\v{S}} Š +{\v{z}} ž +{\v{Z}} Ž +{\'y} ý +{\.{z}} ż diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/pod-coverage.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/pod-coverage.t new file mode 100644 index 00000000000..fc40a57c2a4 --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/pod-coverage.t @@ -0,0 +1,18 @@ +use strict; +use warnings; +use Test::More; + +# Ensure a recent version of Test::Pod::Coverage +my $min_tpc = 1.08; +eval "use Test::Pod::Coverage $min_tpc"; +plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" + if $@; + +# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version, +# but older versions don't recognize some common documentation styles +my $min_pc = 0.18; +eval "use Pod::Coverage $min_pc"; +plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" + if $@; + +all_pod_coverage_ok(); diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/pod.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/pod.t new file mode 100644 index 00000000000..e22a39b5244 --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/pod.t @@ -0,0 +1,12 @@ +#!/usr/bin/perl -w + +use strict; +use warnings; +use Test::More; + +# Ensure a recent version of Test::Pod +my $min_tp = 1.22; +eval "use Test::Pod $min_tp"; +plan skip_all => "Test::Pod $min_tp required for testing POD" if $@; + +all_pod_files_ok(); diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/release-pod-coverage.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/release-pod-coverage.t new file mode 100644 index 00000000000..3a818499f0e --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/release-pod-coverage.t @@ -0,0 +1,21 @@ +#!perl + +BEGIN { + unless ($ENV{RELEASE_TESTING}) { + require Test::More; + Test::More::plan(skip_all => 'these tests are for release candidate testing'); + } +} + + +use Test::More; + +eval "use Test::Pod::Coverage 1.08"; +plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage" + if $@; + +eval "use Pod::Coverage::TrustPod"; +plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage" + if $@; + +all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/release-pod-syntax.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/release-pod-syntax.t new file mode 100644 index 00000000000..d46a9556946 --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/release-pod-syntax.t @@ -0,0 +1,15 @@ +#!perl + +BEGIN { + unless ($ENV{RELEASE_TESTING}) { + require Test::More; + Test::More::plan(skip_all => 'these tests are for release candidate testing'); + } +} + +use Test::More; + +eval "use Test::Pod 1.41"; +plan skip_all => "Test::Pod 1.41 required for testing POD" if $@; + +all_pod_files_ok(); |