summaryrefslogtreecommitdiff
path: root/t/02-write.t
blob: 70343028847073c76c0fe943f2140bffe00ad14a (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 Config;
use File::Temp;
use Test;

use Config::Parser::toml;

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.IO, Config::Parser::toml), "Write succeeded";

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

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

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