From bd3bc6769547e89dc5d3e255aa4babc2cc5ffe48 Mon Sep 17 00:00:00 2001
From: Patrick Spek
Date: Sat, 4 Jul 2020 13:46:25 +0200
Subject: Overhaul Config to 3.0.0
---
t/10-template.t | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
create mode 100644 t/10-template.t
(limited to 't/10-template.t')
diff --git a/t/10-template.t b/t/10-template.t
new file mode 100644
index 0000000..3baa15b
--- /dev/null
+++ b/t/10-template.t
@@ -0,0 +1,53 @@
+#!/usr/bin/env raku
+
+use v6.d;
+
+use Test;
+
+use Config;
+
+plan 2;
+
+subtest 'Flat template', {
+ plan 6;
+
+ my $config = Config.new({
+ foo => Any,
+ bar => Any,
+ }, :name);
+
+ ok $config, 'Config object instantiated';
+
+ ok $config.has('foo'), 'Config contains "foo"';
+ ok $config.has('bar'), 'Config contains "bar"';
+
+ nok $config.has('alpha'), 'Config does not contain "alpha"';
+ nok $config.has('beta'), 'Config does not contain "beta"';
+
+ is $config.keys.sort, < bar foo >, 'Config.keys is correct';
+}
+
+subtest 'Nested template', {
+ plan 7;
+
+ my $config = Config.new({
+ foo => {
+ alpha => Any,
+ },
+ bar => {
+ beta => Any,
+ },
+ baz => Any,
+ }, :name);
+
+ ok $config, 'Config object instantiated';
+
+ ok $config.has('foo'), 'Config contains "foo"';
+ ok $config.has('foo.alpha'), 'Config contains "foo.alpha"';
+ ok $config.has('baz'), 'Config contains "baz"';
+
+ nok $config.has('omega.phi'), 'Config does not contain "omega.phi"';
+ nok $config.has('omega'), 'Config does not contain "omega"';
+
+ is $config.keys.sort, < bar.beta baz foo.alpha >, 'Config.keys is correct';
+}
--
cgit v1.1