diff options
author | Patrick Spek <p.spek@tyil.nl> | 2017-04-27 14:53:13 +0200 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2017-04-27 14:53:13 +0200 |
commit | b366ef7066f63df2e19bd93e34de202f34a1c282 (patch) | |
tree | b05a1017ca725e6d8f429836f6d76a3e7085ec42 /t/02-write.t |
Initial commit
Diffstat (limited to 't/02-write.t')
-rw-r--r-- | t/02-write.t | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/t/02-write.t b/t/02-write.t new file mode 100644 index 0000000..5eb7d92 --- /dev/null +++ b/t/02-write.t @@ -0,0 +1,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"; |