Debian Codegraph @

test/key_make_alias.t

raw
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 key_make_alias.t - Test suite for BibTool key.make.alias.
31
32 =head1 SYNOPSIS
33
34 key_make_alias.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 #------------------------------------------------------------------------------
59 BUnit::run(name => 'key_make_alias_1',
60 bib => <<__EOF__,
61 \@article{xyzzy, author={A.U.Thor}, title="The Title"}
62 __EOF__
63 resource => <<__EOF__,
64 key.generation=on
65 key.format=short
66 key.make.alias=on
67 __EOF__
68 expected_out => <<__EOF__,
69
70 \@Article{ thor:title,
71 author = {A.U.Thor},
72 title = "The Title"
73 }
74 \@ALIAS{xyzzy = thor:title }
75 __EOF__
76 expected_err => '' );
77
78 #------------------------------------------------------------------------------
79 BUnit::run(name => 'key_make_alias_2',
80 bib => <<__EOF__,
81 \@article{thor:title, author={A.U.Thor}, title="The Title"}
82 __EOF__
83 resource => <<__EOF__,
84 key.generation=on
85 key.format=short
86 key.make.alias=on
87 __EOF__
88 expected_out => <<__EOF__,
89
90 \@Article{ thor:title,
91 author = {A.U.Thor},
92 title = "The Title"
93 }
94 __EOF__
95 expected_err => '' );
96
97 #------------------------------------------------------------------------------
98 BUnit::run(name => 'key_make_alias_3',
99 bib => <<__EOF__,
100 \@article{, author={A.U.Thor}, title="The Title"}
101 __EOF__
102 resource => <<__EOF__,
103 key.generation=on
104 key.format=short
105 key.make.alias=on
106 quiet=on
107 __EOF__
108 expected_out => <<__EOF__,
109
110 \@Article{ thor:title,
111 author = {A.U.Thor},
112 title = "The Title"
113 }
114 __EOF__
115 expected_err => '' );
116
117 #------------------------------------------------------------------------------
118 BUnit::run(name => 'key_make_alias_4',
119 resource => <<__EOF__ ,
120 key.base = digit
121 key.format=short
122 key.make.alias=on
123 __EOF__
124 bib => <<__EOF__,
125 \@Misc{ xxx,
126 author = "A. U. Thor"
127 }
128 \@Misc{ xxx,
129 author = "A. U. Thor"
130 }
131 __EOF__
132 expected_out => <<__EOF__ );
133
134 \@Misc{ thor,
135 author = "A. U. Thor"
136 }
137
138 \@Misc{ thor*1,
139 author = "A. U. Thor"
140 }
141 \@ALIAS{xxx = thor }
142 \@ALIAS{xxx = thor*1 }
143 __EOF__
144
145 1;
146 #------------------------------------------------------------------------------
147 # Local Variables:
148 # mode: perl
149 # End: