| 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) 2011-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 |
add_field.t - Test suite for BibTool add.field. |
| 31 |
|
| 32 |
=head1 SYNOPSIS |
| 33 |
|
| 34 |
add_field.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 warnings; |
| 55 |
use BUnit; |
| 56 |
|
| 57 |
|
| 58 |
#------------------------------------------------------------------------------ |
| 59 |
BUnit::run(name => 'add_field_1', |
| 60 |
args => 'bib/x1.bib', |
| 61 |
resource => 'add.field={xyzzy="abc"}', |
| 62 |
expected_out => <<__EOF__, |
| 63 |
|
| 64 |
\@Manual{ bibtool, |
| 65 |
title = {BibTool}, |
| 66 |
author = {Gerd Neugebauer}, |
| 67 |
year = 2018, |
| 68 |
xyzzy = {abc} |
| 69 |
} |
| 70 |
__EOF__ |
| 71 |
expected_err => '' ); |
| 72 |
|
| 73 |
#------------------------------------------------------------------------------ |
| 74 |
BUnit::run(name => 'add_field_2', |
| 75 |
args => 'bib/x1.bib', |
| 76 |
resource => 'add.field={xyzzy={abc}}', |
| 77 |
expected_out => <<__EOF__, |
| 78 |
|
| 79 |
\@Manual{ bibtool, |
| 80 |
title = {BibTool}, |
| 81 |
author = {Gerd Neugebauer}, |
| 82 |
year = 2018, |
| 83 |
xyzzy = {abc} |
| 84 |
} |
| 85 |
__EOF__ |
| 86 |
expected_err => '' ); |
| 87 |
|
| 88 |
#------------------------------------------------------------------------------ |
| 89 |
BUnit::run(name => 'add_field_3', |
| 90 |
args => 'bib/x1.bib', |
| 91 |
resource => 'add.field={xyzzy=abc}', |
| 92 |
expected_out => <<__EOF__, |
| 93 |
|
| 94 |
\@Manual{ bibtool, |
| 95 |
title = {BibTool}, |
| 96 |
author = {Gerd Neugebauer}, |
| 97 |
year = 2018, |
| 98 |
xyzzy = {abc} |
| 99 |
} |
| 100 |
__EOF__ |
| 101 |
expected_err => '' ); |
| 102 |
|
| 103 |
1; |
| 104 |
#------------------------------------------------------------------------------ |
| 105 |
# Local Variables: |
| 106 |
# mode: perl |
| 107 |
# End: |