1use Config::Std;
2use Test::More 'no_plan';
3
4my $data = q{
5# A comment
6foo: bar   # Not a trailing comment. This is data for the 'foo' config var
7
8; Another comment
9baz: qux   ; Not a trailing comment. This is data for the 'qux' config var
10};
11
12# Read in the config file from Example 19-3...
13read_config \$data => my %config;
14
15write_config %config, \$results;
16is $results, $data    => "Comments preserved on simple round-trip";
17
18$config{""}{foo} = 'baz';
19$config{""}{baz} = 'foo';
20$data =~ s/bar.*/baz/;
21$data =~ s/qux.*/foo/;
22
23write_config %config, \$results;
24is $results, $data    => "Comments preserved on mutating round-trip";
25