diff options
author | Patrick Spek <p.spek@tyil.nl> | 2020-07-04 13:46:25 +0200 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2020-07-12 08:59:13 +0200 |
commit | bd3bc6769547e89dc5d3e255aa4babc2cc5ffe48 (patch) | |
tree | 974bf72d443dbf0d1bffea29793becee806b43bc /t/10-template.t | |
parent | 2d0de9cc3f93f661044f20b55c6a03860e8a0de8 (diff) |
Overhaul Config to 3.0.0
Diffstat (limited to 't/10-template.t')
-rw-r--r-- | t/10-template.t | 53 |
1 files changed, 53 insertions, 0 deletions
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<raku-config>); + + 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<raku-config>); + + 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'; +} |