diff options
Diffstat (limited to 't/reading.t')
-rw-r--r-- | t/reading.t | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/t/reading.t b/t/reading.t index 52859af..e43252a 100644 --- a/t/reading.t +++ b/t/reading.t @@ -4,7 +4,7 @@ use v6.c; use Test; use lib "lib"; -plan 3; +plan 5; use Config; @@ -13,3 +13,28 @@ my $config = Config.new(); throws-like { $config.read("nonexistant-config") }, Config::Exception::FileNotFoundException, "Reading nonexisting file"; throws-like { $config.read("t/test-stub") }, Config::Exception::UnknownTypeException, "Reading file of unknown type"; throws-like { $config.read("t/test-stub", "Config::Parser:NoSuchParserForTest") }, Config::Exception::MissingParserException, "Using non-existing parser"; + +my $hash = { + "a" => "a", + "b" => { + "c" => "test" + } +}; + +$config.read($hash); + +is-deeply $config.get(), $hash, "Correctly sets hash"; + +$config.read({ + "b" => { + "d" => "another" + } +}); + +is-deeply $config.get(), { + "a" => "a", + "b" => { + "c" => "test", + "d" => "another" + } +}, "Correctly merges new hash into existing config"; |