| 1 | use Test2::V0scip-perl cpan Catmandu-BibTeX 0.21 Test2/V0/; |
| 2 | |
| 3 | use Clonescip-perl cpan Catmandu-BibTeX 0.21 Clone/ qw(clone); |
| 4 | use Catmandu::Exporter::BibTeXscip-perl cpan Catmandu-BibTeX 0.21 Catmandu/Exporter/BibTeX/; |
| 5 | |
| 6 | # don't touch this! Exporter adds newline at the end. |
| 7 | my $bibtex = <<TEX; |
| 8 | \@inproceedings{2602779, |
| 9 | author = {{Boukricha, Hana and Wachsmuth, Ipke and Carminati, Maria Nella and Knoeferle, Pia and Müller-Leßmann, Stephan}}, |
| 10 | keywords = {{computer science}}, |
| 11 | language = {{English}}, |
| 12 | publisher = {{IEEE}}, |
| 13 | title = {{A Computational Model of Empathy: Empirical Evaluation}}, |
| 14 | year = {{2013}}, |
| 15 | } |
| 16 | |
| 17 | TEX |
| 18 | |
| 19 | my $data = { |
| 20 | _citekey => 2602779, |
| 21 | _type => 'inproceedings', |
| 22 | author => [ |
| 23 | "Boukricha, Hana", |
| 24 | "Wachsmuth, Ipke", |
| 25 | "Carminati, Maria Nella", |
| 26 | "Knoeferle, Pia", |
| 27 | "Müller-Leßmann, Stephan" |
| 28 | ], |
| 29 | language => 'English', |
| 30 | publisher => 'IEEE', |
| 31 | year => 2013, |
| 32 | title => 'A Computational Model of Empathy: Empirical Evaluation', |
| 33 | keywords => 'computer science' |
| 34 | }; |
| 35 | |
| 36 | my $data2 = clonescip-perl cpan Catmandu-BibTeX 0.21 main/clone().($data); |
| 37 | |
| 38 | my $bibtex_out; |
| 39 | my $exporter = Catmandu::Exporter::BibTeX->newscip-perl cpan Catmandu-BibTeX 0.21 Catmandu/Exporter/BibTeX/new().(file => \$bibtex_out); |
| 40 | |
| 41 | isa_okscip-perl cpan Catmandu-BibTeX 0.21 main/isa_ok().($exporter, "Catmandu::Exporter::BibTeX"); |
| 42 | |
| 43 | can_okscip-perl cpan Catmandu-BibTeX 0.21 main/can_ok().($exporter, 'add'); |
| 44 | |
| 45 | can_okscip-perl cpan Catmandu-BibTeX 0.21 main/can_ok().($exporter, 'add_many'); |
| 46 | |
| 47 | $exporter->addscip-perl cpan Catmandu-BibTeX 0.21 Catmandu/Exporter/BibTeX/add().($data); |
| 48 | |
| 49 | isscip-perl cpan Catmandu-BibTeX 0.21 main/is().($bibtex, $bibtex_out, "compare output"); |
| 50 | |
| 51 | isscip-perl cpan Catmandu-BibTeX 0.21 main/is().($data, $data2, "exporter is idempotent"); |
| 52 | |
| 53 | done_testing; |