summaryrefslogtreecommitdiff
path: root/t/02-write.t
blob: 5eb7d92381148e0925ce699bba070c32d696cea4 (plain)
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
#! /usr/bin/env perl6

use v6.c;
use Test;
use lib "lib";

use Config;
use Config::Parser::toml;
use File::Temp;

plan 4;

my $config = Config.new();

$config.read({
    first => {
        a => "a",
        b => "b"
    },
    second => {
        a => "a",
        c => "c"
    }
});

my ($filename, $fh) = tempfile;

ok $config.write($filename, "Config::Parser::toml"), "Write succeeded";

is slurp("t/files/write.toml"), slurp($filename), "Written config is correct";

ok $config.write($filename, "Config::Parser::toml"), "Write over non-empty file";

is slurp("t/files/write.toml"), slurp($filename), "Written config is still correct";