Debian Codegraph @

test/select.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 select.t - Test suite for BibTool select.
31
32 =head1 SYNOPSIS
33
34 select.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 => '_X_0',
60 args => '-X',
61 expected_err => <<__EOF__);
62
63 *** BibTool WARNING: Missing pattern.
64 __EOF__
65
66 #------------------------------------------------------------------------------
67 BUnit::run(name => '_X_1',
68 args => '-X aa',
69 expected_err => '',
70 bib => <<__EOF__,
71 \@article{ aaa,
72 author = "aa",
73 title = "the title"
74 }
75 \@article{ aba,
76 author = "bb",
77 title = "Just another text"
78 }
79 __EOF__
80 expected_out => <<__EOF__);
81
82 \@Article{ aaa,
83 author = "aa",
84 title = "the title"
85 }
86 __EOF__
87
88 #------------------------------------------------------------------------------
89 BUnit::run(name => '_X_2',
90 args => '-X a+a+',
91 expected_err => '',
92 bib => <<__EOF__,
93 \@article{ aaa,
94 author = "aa",
95 title = "the title"
96 }
97 \@article{ aba,
98 author = "bb",
99 title = "Just another text"
100 }
101 __EOF__
102 expected_out => <<__EOF__);
103
104 \@Article{ aaa,
105 author = "aa",
106 title = "the title"
107 }
108 __EOF__
109
110 #------------------------------------------------------------------------------
111 BUnit::run(name => 'select_1',
112 args => '--select\'{"aa"}\'',
113 expected_err => '',
114 bib => <<__EOF__,
115 \@article{ a,
116 author = "aa",
117 title = "the title"
118 }
119 \@article{ b,
120 author = "bb",
121 title = "THE TITLE"
122 }
123 __EOF__
124 expected_out => <<__EOF__);
125
126 \@Article{ a,
127 author = "aa",
128 title = "the title"
129 }
130 __EOF__
131
132 #------------------------------------------------------------------------------
133 BUnit::run(name => 'select_2',
134 args => '--select\'{"title"}\'',
135 expected_err =>'',
136 bib => <<__EOF__,
137 \@article{ a,
138 author = "aa",
139 title = "the title"
140 }
141 \@article{ b,
142 author = "bb",
143 title = "Just another text"
144 }
145 __EOF__
146 expected_out => <<__EOF__);
147
148 \@Article{ a,
149 author = "aa",
150 title = "the title"
151 }
152 __EOF__
153
154 #------------------------------------------------------------------------------
155 BUnit::run(name => 'select_3',
156 args => '--select\'{"t.*le"}\'',
157 expected_err =>'',
158 bib => <<__EOF__,
159 \@article{ a,
160 author = "aa",
161 title = "the title"
162 }
163 \@article{ b,
164 author = "bb",
165 title = "Just another text"
166 }
167 __EOF__
168 expected_out => <<__EOF__);
169
170 \@Article{ a,
171 author = "aa",
172 title = "the title"
173 }
174 __EOF__
175
176
177 1;
178 #------------------------------------------------------------------------------
179 # Local Variables:
180 # mode: perl
181 # End: