Debian Codegraph @

t/30parameters-with-empty-values.t

raw symbols SCIP
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 # This test file tests:
7 #
8 # https://rt.cpan.org/Public/Bug/Display.html?id=68554
9 #
10 # << Parameters with empty values not written to file >>
11
12 use Test::More tests => 1;
13
14 use Config::IniFiles;
15
16 use lib "./t/lib";
17
18 use Config::IniFiles::TestPaths;
19 use Config::IniFiles::Slurp qw( slurp );
20
21 {
22 my $filename = t_file('params_30.ini');
23
24 unlink($filename);
25
26 my $ini = Config::IniFiles->new();
27
28 $ini->newval( 'MySection', 'MyParam', '' );
29
30 $ini->WriteConfig($filename);
31
32 my $contents = slurp($filename);
33
34 unlink($filename);
35
36 # TEST
37 like( $contents, qr{^MyParam=$}ms, 'Empty parameter was written.' );
38 }
39
40 =head1 COPYRIGHT & LICENSE
41
42 Copyright 2011 by Shlomi Fish
43
44 This program is distributed under the MIT (Expat) License:
45 L<http://www.opensource.org/licenses/mit-license.php>
46
47 Permission is hereby granted, free of charge, to any person
48 obtaining a copy of this software and associated documentation
49 files (the "Software"), to deal in the Software without
50 restriction, including without limitation the rights to use,
51 copy, modify, merge, publish, distribute, sublicense, and/or sell
52 copies of the Software, and to permit persons to whom the
53 Software is furnished to do so, subject to the following
54 conditions:
55
56 The above copyright notice and this permission notice shall be
57 included in all copies or substantial portions of the Software.
58
59 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
60 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
61 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
62 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
63 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
64 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
65 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
66 OTHER DEALINGS IN THE SOFTWARE.
67
68 =cut