From c2b980b7962951bc5c277473d41974e76a5e66fa Mon Sep 17 00:00:00 2001
From: Patrick Spek
Date: Wed, 26 Apr 2017 23:10:00 +0200
Subject: Rename test files
---
t/01-reading.t | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
create mode 100644 t/01-reading.t
(limited to 't/01-reading.t')
diff --git a/t/01-reading.t b/t/01-reading.t
new file mode 100644
index 0000000..0792188
--- /dev/null
+++ b/t/01-reading.t
@@ -0,0 +1,40 @@
+#! /usr/bin/env perl6
+
+use v6.c;
+use Test;
+use lib "lib";
+
+plan 5;
+
+use Config;
+
+my $config = Config.new();
+
+throws-like { $config.read("t/files/none") }, Config::Exception::FileNotFoundException, "Reading nonexisting file";
+throws-like { $config.read("t/files/config") }, Config::Exception::UnknownTypeException, "Reading file of unknown type";
+throws-like { $config.read("t/files/config", "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";
--
cgit v1.1