Debian Codegraph @

test/bibtool.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) 2015-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 bibtool.t - Test suite for BibTool.
31
32 =head1 SYNOPSIS
33
34 bibtool.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 => 'bibtool_1',
60 bib => <<__EOF__,
61 \@Manual{BibTool,
62 title = {BibTool},
63 author = "Gerd "#"Neugebauer",
64 year = "x" # "x" # "x"
65 }
66 __EOF__
67 expected_out => <<__EOF__,
68
69 \@Manual{ bibtool,
70 title = {BibTool},
71 author = "Gerd " # "Neugebauer",
72 year = "x" # "x" # "x"
73 }
74 __EOF__
75 expected_err => ""
76 );
77
78 #------------------------------------------------------------------------------
79 BUnit::run(name => 'bibtool_2',
80 bib => <<__EOF__,
81 \@Manual{BibTool,
82 title = {BibTool},
83 author = "Gerd Neugebauer",
84 year = "x" # may # {x} #"x"
85 }
86 __EOF__
87 expected_out => <<__EOF__,
88
89 \@Manual{ bibtool,
90 title = {BibTool},
91 author = "Gerd Neugebauer",
92 year = "x" # may # {x} # "x"
93 }
94 __EOF__
95 expected_err => ""
96 );
97
98 #------------------------------------------------------------------------------
99 BUnit::run(name => 'bibtool_special_underscore',
100 bib => <<__EOF__,
101 \@Manual{BibTool,
102 _title = {BibTool},
103 author = "Gerd Neugebauer",
104 year = "x"
105 }
106 __EOF__
107 expected_out => <<__EOF__,
108
109 \@Manual{ bibtool,
110 _title = {BibTool},
111 author = "Gerd Neugebauer",
112 year = "x"
113 }
114 __EOF__
115 expected_err => <<__EOF__
116
117 _title = {BibTool},
118 ___^
119 *** BibTool WARNING (line 2 in ./_test.bib): Symbol does not start with a letter
120 __EOF__
121 );
122
123 #------------------------------------------------------------------------------
124 BUnit::run(name => 'bibtool_special_dollar',
125 bib => <<__EOF__,
126 \@Manual{BibTool,
127 \$title = {BibTool},
128 author = "Gerd Neugebauer",
129 year = "x"
130 }
131 __EOF__
132 expected_out => <<__EOF__,
133
134 \@Manual{ bibtool,
135 \$title = {BibTool},
136 author = "Gerd Neugebauer",
137 year = "x"
138 }
139 __EOF__
140 expected_err => <<__EOF__
141
142 \$title = {BibTool},
143 ___^
144 *** BibTool WARNING (line 2 in ./_test.bib): Symbol does not start with a letter
145 __EOF__
146 );
147
148 #------------------------------------------------------------------------------
149 BUnit::run(name => 'bibtool_special_exclamation',
150 bib => <<__EOF__,
151 \@Manual{BibTool,
152 !title = {BibTool},
153 author = "Gerd Neugebauer",
154 year = "x"
155 }
156 __EOF__
157 expected_out => <<__EOF__,
158
159 \@Manual{ bibtool,
160 !title = {BibTool},
161 author = "Gerd Neugebauer",
162 year = "x"
163 }
164 __EOF__
165 expected_err => <<__EOF__
166
167 !title = {BibTool},
168 ___^
169 *** BibTool WARNING (line 2 in ./_test.bib): Symbol does not start with a letter
170 __EOF__
171 );
172
173 #------------------------------------------------------------------------------
174 # Local Variables:
175 # mode: perl
176 # End: