File: print_entry_types.t

package info (click to toggle)
bibtool 2.55%2Bds-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 2,376 kB
  • sloc: ansic: 10,685; perl: 6,205; makefile: 477; sh: 351; tcl: 51
file content (205 lines) | stat: -rw-r--r-- 4,888 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#!/bin/perl -W
#******************************************************************************
# $Id: print_entry_types.t,v 1.1 2011-12-04 13:22:40 gene Exp $
# =============================================================================
#  
#  This file is part of BibTool.
#  It is distributed under the GNU General Public License.
#  See the file COPYING for details.
#  
#  (c) 2011 Gerd Neugebauer
#  
#  Net: gene@gerd-neugebauer.de
#  
#*=============================================================================

=head1 NAME

print_entry_types.t - Test suite for BibTool print.entry.types.

=head1 SYNOPSIS

print_entry_types.t

=head1 DESCRIPTION

This module contains some test cases. Running this module as program
will run all test cases and print a summary for each. Optionally files
*.out and *.err are left if the expected result does not match the
actual result.

=head1 OPTIONS

none

=head1 AUTHOR

Gerd Neugebauer

=head1 BUGS

=over 4

=item *

...

=back

=cut

use strict;
use BUnit;

use constant BIB_3 =><<__EOF__;
start
\@article{art, author="A.U. Thor"}
\@string{s	     ="s"}
\@string{t	     ="t"}
\@preamble{preamble}
\@book{bk, author =s}
\@alias{kb=bk}
the comment
__EOF__

#------------------------------------------------------------------------------
BUnit::run(name         => 'print_entry_types_0',
	   args		=> 'bib/xampl.bib',
	   resource	=> <<__EOF__ ,
	   print.entry.types = {}
__EOF__
	   expected_out => '' );

#------------------------------------------------------------------------------
BUnit::run(name         => 'print_entry_types_p1',
	   bib		=> BIB_3,
	   resource	=> <<__EOF__ ,
	   print.entry.types {p}
__EOF__
	   expected_out => <<__EOF__ );
\@PREAMBLE{ preamble }
__EOF__

#------------------------------------------------------------------------------
BUnit::run(name         => 'print_entry_types_p2',
	   args		=> 'bib/xampl.bib',
	   resource	=> <<__EOF__ ,
	   print.entry.types {p}
__EOF__
	   expected_out => <<__EOF__ );
\@PREAMBLE{ "\\newcommand{\\noopsort}[1]{} " 
	 # "\\newcommand{\\printfirst}[2]{#1} " 
	 # "\\newcommand{\\singleletter}[1]{#1} " 
	 # "\\newcommand{\\switchargs}[2]{#2#1} " }
__EOF__

#------------------------------------------------------------------------------
BUnit::run(name         => 'print_entry_types_s1',
	   bib		=> BIB_3,
	   resource	=> <<__EOF__ ,
	   print.entry.types {s}
__EOF__
	   expected_out => <<__EOF__ );
\@STRING{s	= "s" }
\@STRING{t	= "t" }
__EOF__

#------------------------------------------------------------------------------
BUnit::run(name         => 'print_entry_types_s2',
	   args		=> 'bib/xampl.bib',
	   resource	=> <<__EOF__ ,
	   print.entry.types {S}
__EOF__
	   expected_out => <<__EOF__ );
\@STRING{acm	= "The OX Association for Computing Machinery" }
\@STRING{stoc	= " Symposium on the Theory of Computing" }
\@STRING{stoc-key= "OX{\\singleletter{stoc}}" }
__EOF__

#------------------------------------------------------------------------------
BUnit::run(name         => 'print_entry_types_S1',
	   bib		=> BIB_3,
	   resource	=> <<__EOF__ ,
	   print.entry.types {S}
__EOF__
	   expected_out => <<__EOF__ );
\@STRING{s	= "s" }
__EOF__


#------------------------------------------------------------------------------
BUnit::run(name         => 'print_entry_types_dollar1',
	   bib		=> BIB_3,
	   resource	=> <<__EOF__ ,
	   print.entry.types {\$}
__EOF__
	   expected_out => <<__EOF__ );
\@STRING{s	= "s" }
\@STRING{t	= "t" }
__EOF__

#------------------------------------------------------------------------------
BUnit::run(name         => 'print_entry_types_c1',
	   ignore	=> 1,
	   bib		=> BIB_3,
	   resource	=> <<__EOF__ ,
	   print.entry.types {c}
__EOF__
	   expected_out => <<__EOF__ );
the comment
__EOF__

#------------------------------------------------------------------------------
BUnit::run(name         => 'print_entry_types_a1',
	   bib		=> BIB_3,
	   resource	=> <<__EOF__ ,
	   print.entry.types {a}
__EOF__
	   expected_out => <<__EOF__ );
\@ALIAS{kb	= bk }
__EOF__

#------------------------------------------------------------------------------
BUnit::run(name         => 'print_entry_types_n1',
	   bib		=> BIB_3,
	   resource	=> <<__EOF__ ,
	   print.entry.types {n}
__EOF__
	   expected_out => <<__EOF__ );

\@Article{	  art,
  author	= "A.U. Thor"
}

\@Book{		  bk,
  author	= s
}
__EOF__

#------------------------------------------------------------------------------
BUnit::run(name         => 'print_entry_types_1',
	   bib		=> BIB_3,
	   resource	=> <<__EOF__ ,
__EOF__
	   #expected_err	=> '',
	   expected_out	=> <<__EOF__ );
\@PREAMBLE{ preamble }
\@STRING{s	= "s" }
\@STRING{t	= "t" }

\@Article{	  art,
  author	= "A.U. Thor"
}

\@Book{		  bk,
  author	= s
}
\@ALIAS{kb	= bk }
__EOF__


1;
#------------------------------------------------------------------------------
# Local Variables: 
# mode: perl
# End: