aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2017-04-26 23:08:59 +0200
committerPatrick Spek <p.spek@tyil.nl>2023-07-25 02:16:19 +0200
commit312b33592df7409745b44503e5558bb173a8e6f7 (patch)
treefafb21c1c9db6f543fb213c9d658e5f91f027788 /t
parent0a93729f52df56663ba61766663166de9db98f23 (diff)
Add Config::Parser::NULL for testcases
Diffstat (limited to 't')
-rw-r--r--t/05-null-parser.t30
-rw-r--r--t/files/config (renamed from t/test-stub)0
-rw-r--r--t/files/config.yaml0
-rw-r--r--t/reading.t6
4 files changed, 33 insertions, 3 deletions
diff --git a/t/05-null-parser.t b/t/05-null-parser.t
new file mode 100644
index 0000000..97e897f
--- /dev/null
+++ b/t/05-null-parser.t
@@ -0,0 +1,30 @@
+#! /usr/bin/env perl6
+
+use v6.c;
+use Test;
+use lib "lib";
+
+use Config;
+use Config::Parser::NULL;
+
+plan 3;
+
+::("Config::Parser::NULL").set-config({
+ "a" => "a",
+ "b" => {
+ "c" => "c"
+ }
+});
+
+my $config = Config.new();
+
+ok $config.read("t/files/config", "Config::Parser::NULL"), "Attempt to read a file with Config::Parser::NULL";
+
+is-deeply $config.get(), {
+ "a" => "a",
+ "b" => {
+ "c" => "c"
+ }
+}, "Check read config from Config::Parser::NULL";
+
+ok $config.write("t/t/t"), "Attempt to write a file with Config::Parser::NULL";
diff --git a/t/test-stub b/t/files/config
index e69de29..e69de29 100644
--- a/t/test-stub
+++ b/t/files/config
diff --git a/t/files/config.yaml b/t/files/config.yaml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/t/files/config.yaml
diff --git a/t/reading.t b/t/reading.t
index e43252a..0792188 100644
--- a/t/reading.t
+++ b/t/reading.t
@@ -10,9 +10,9 @@ use Config;
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";
+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",