| 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 |
select_crossrefs.t - Test suite for BibTool select.crossrefs. |
| 31 |
|
| 32 |
=head1 SYNOPSIS |
| 33 |
|
| 34 |
select_crossrefs.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 BUnit;use warnings; |
| 55 |
|
| 56 |
|
| 57 |
#------------------------------------------------------------------------------ |
| 58 |
BUnit::run(name => 'select_crossrefs_0', |
| 59 |
args => '--select\'{"aa"}\' -- select.crossrefs=off', |
| 60 |
expected_err =>'', |
| 61 |
bib => <<__EOF__, |
| 62 |
\@article{ a, |
| 63 |
author = "aa", |
| 64 |
title = "the title", |
| 65 |
crossref= "b" |
| 66 |
} |
| 67 |
\@article{ b, |
| 68 |
author = "bb", |
| 69 |
title = "THE TITLE" |
| 70 |
} |
| 71 |
__EOF__ |
| 72 |
expected_out => <<__EOF__); |
| 73 |
|
| 74 |
\@Article{ a, |
| 75 |
author = "aa", |
| 76 |
title = "the title", |
| 77 |
crossref = "b" |
| 78 |
} |
| 79 |
__EOF__ |
| 80 |
|
| 81 |
#------------------------------------------------------------------------------ |
| 82 |
BUnit::run(name => 'select_crossrefs_1', |
| 83 |
args => '--select\'{"aa"}\' -- select.crossrefs=on', |
| 84 |
expected_err => '', |
| 85 |
bib => <<__EOF__, |
| 86 |
\@article{ a, |
| 87 |
author = "aa", |
| 88 |
title = "the title", |
| 89 |
crossref= "b" |
| 90 |
} |
| 91 |
\@article{ b, |
| 92 |
author = "bb", |
| 93 |
title = "THE TITLE" |
| 94 |
} |
| 95 |
__EOF__ |
| 96 |
expected_out => <<__EOF__); |
| 97 |
|
| 98 |
\@Article{ a, |
| 99 |
author = "aa", |
| 100 |
title = "the title", |
| 101 |
crossref = "b" |
| 102 |
} |
| 103 |
|
| 104 |
\@Article{ b, |
| 105 |
author = "bb", |
| 106 |
title = "THE TITLE" |
| 107 |
} |
| 108 |
__EOF__ |
| 109 |
|
| 110 |
#------------------------------------------------------------------------------ |
| 111 |
BUnit::run(name => 'select_crossrefs_2', |
| 112 |
args => '--select\'{"aa"}\' -- select.crossrefs=on', |
| 113 |
expected_err => '', |
| 114 |
bib => <<__EOF__, |
| 115 |
\@article{ a, |
| 116 |
author = "aa", |
| 117 |
title = "the title", |
| 118 |
crossref= "b" |
| 119 |
} |
| 120 |
\@article{ b, |
| 121 |
author = "bb", |
| 122 |
title = "THE title", |
| 123 |
crossref= "c" |
| 124 |
} |
| 125 |
\@article{ c, |
| 126 |
author = "cc", |
| 127 |
title = "THE TITLE" |
| 128 |
} |
| 129 |
__EOF__ |
| 130 |
expected_out => <<__EOF__); |
| 131 |
|
| 132 |
\@Article{ a, |
| 133 |
author = "aa", |
| 134 |
title = "the title", |
| 135 |
crossref = "b" |
| 136 |
} |
| 137 |
|
| 138 |
\@Article{ b, |
| 139 |
author = "bb", |
| 140 |
title = "THE title", |
| 141 |
crossref = "c" |
| 142 |
} |
| 143 |
|
| 144 |
\@Article{ c, |
| 145 |
author = "cc", |
| 146 |
title = "THE TITLE" |
| 147 |
} |
| 148 |
__EOF__ |
| 149 |
|
| 150 |
#------------------------------------------------------------------------------ |
| 151 |
BUnit::run(name => '_X_c_1', |
| 152 |
args => '-X aa -c', |
| 153 |
expected_err => '', |
| 154 |
bib => <<__EOF__, |
| 155 |
\@article{ aa, |
| 156 |
author = "aa", |
| 157 |
title = "the title", |
| 158 |
crossref= "b" |
| 159 |
} |
| 160 |
\@article{ b, |
| 161 |
author = "bb", |
| 162 |
title = "THE TITLE" |
| 163 |
} |
| 164 |
__EOF__ |
| 165 |
expected_out => <<__EOF__); |
| 166 |
|
| 167 |
\@Article{ aa, |
| 168 |
author = "aa", |
| 169 |
title = "the title", |
| 170 |
crossref = "b" |
| 171 |
} |
| 172 |
|
| 173 |
\@Article{ b, |
| 174 |
author = "bb", |
| 175 |
title = "THE TITLE" |
| 176 |
} |
| 177 |
__EOF__ |
| 178 |
|
| 179 |
#------------------------------------------------------------------------------ |
| 180 |
BUnit::run(name => '_X_c_2', |
| 181 |
args => '-X aa -c', |
| 182 |
expected_err => '', |
| 183 |
bib => <<__EOF__, |
| 184 |
\@article{ aa, |
| 185 |
author = "aa", |
| 186 |
title = "the title", |
| 187 |
crossref= "b" |
| 188 |
} |
| 189 |
\@article{ b, |
| 190 |
author = "bb", |
| 191 |
title = "THE title", |
| 192 |
crossref= "c" |
| 193 |
} |
| 194 |
\@article{ c, |
| 195 |
author = "cc", |
| 196 |
title = "THE TITLE" |
| 197 |
} |
| 198 |
__EOF__ |
| 199 |
expected_out => <<__EOF__); |
| 200 |
|
| 201 |
\@Article{ aa, |
| 202 |
author = "aa", |
| 203 |
title = "the title", |
| 204 |
crossref = "b" |
| 205 |
} |
| 206 |
|
| 207 |
\@Article{ b, |
| 208 |
author = "bb", |
| 209 |
title = "THE title", |
| 210 |
crossref = "c" |
| 211 |
} |
| 212 |
|
| 213 |
\@Article{ c, |
| 214 |
author = "cc", |
| 215 |
title = "THE TITLE" |
| 216 |
} |
| 217 |
__EOF__ |
| 218 |
|
| 219 |
|
| 220 |
1; |
| 221 |
#------------------------------------------------------------------------------ |
| 222 |
# Local Variables: |
| 223 |
# mode: perl |
| 224 |
# End: |