From b366ef7066f63df2e19bd93e34de202f34a1c282 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Thu, 27 Apr 2017 14:53:13 +0200 Subject: Initial commit --- t/02-write.t | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 t/02-write.t (limited to 't/02-write.t') 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"; -- cgit v1.1