Debian Codegraph @

test/apply_modify.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 apply_modify.t - Test suite for BibTool apply.modify.
31
32 =head1 SYNOPSIS
33
34 apply_modify.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 => 'apply_modify_0',
60 bib => <<__EOF__,
61 \@article{xyzzy, a=987}
62 \@modify{xyzzy, a=123}
63 __EOF__
64 resource => 'apply.modify=off',
65 expected_out => <<__EOF__,
66
67 \@Article{ xyzzy,
68 a = 987
69 }
70 \@MODIFY{ xyzzy,
71 a = 123
72 }
73 __EOF__
74 expected_err => '' );
75
76 #------------------------------------------------------------------------------
77 BUnit::run(name => 'apply_modify_1',
78 bib => <<__EOF__,
79 \@article{xyzzy, a=987}
80 \@modify{xyzzy, a=123}
81 __EOF__
82 resource => 'apply.modify=on',
83 expected_out => <<__EOF__,
84
85 \@Article{ xyzzy,
86 a = 123
87 }
88 __EOF__
89 expected_err => '' );
90
91 #------------------------------------------------------------------------------
92 BUnit::run(name => 'apply_modify_2',
93 bib => <<__EOF__,
94 \@article{xyzzy, a=987}
95 \@modify{xyzzy, b=123}
96 __EOF__
97 resource => 'apply.modify=on',
98 expected_out => <<__EOF__,
99
100 \@Article{ xyzzy,
101 a = 987,
102 b = 123
103 }
104 __EOF__
105 expected_err => '' );
106
107 #------------------------------------------------------------------------------
108 BUnit::run(name => 'apply_modify_3',
109 bib => <<__EOF__,
110 \@article{xyzzy, a=987}
111 \@alias{qqq=xyzzy}
112 \@modify{xyzzy, a=123}
113
114 __EOF__
115 resource => 'apply.modify=on apply.alias=on',
116 expected_out => <<__EOF__,
117
118 \@Article{ xyzzy,
119 a = 123
120 }
121
122 \@Article{ qqq,
123 a = 987
124 }
125 __EOF__
126 expected_err => '' );
127
128 1;
129 #------------------------------------------------------------------------------
130 # Local Variables:
131 # mode: perl
132 # End: