diff options
Diffstat (limited to 't')
-rw-r--r-- | t/getting.t | 22 | ||||
-rw-r--r-- | t/having.t | 21 | ||||
-rw-r--r-- | t/setting.t | 14 |
3 files changed, 57 insertions, 0 deletions
diff --git a/t/getting.t b/t/getting.t new file mode 100644 index 0000000..15937a7 --- /dev/null +++ b/t/getting.t @@ -0,0 +1,22 @@ +#! /usr/bin/env perl6 + +use v6.c; +use Test; +use lib "lib"; + +plan 3; + +use Config; + +my $config = Config.new(); + +$config.read({ + a => "a", + b => { + c => "c" + } +}); + +ok $config.get("a") eq "a"; +ok $config.get("b.c") eq "c"; +ok $config.get("nonexistant") === Nil; diff --git a/t/having.t b/t/having.t new file mode 100644 index 0000000..d0ca5b3 --- /dev/null +++ b/t/having.t @@ -0,0 +1,21 @@ +#! /usr/bin/env perl6 + +use v6.c; +use Test; +use lib "lib"; + +plan 2; + +use Config; + +my $config = Config.new(); + +$config.read({ + a => "a", + b => { + c => "c" + } +}); + +ok $config.has("a"); +ok $config.has("b.c"); diff --git a/t/setting.t b/t/setting.t new file mode 100644 index 0000000..3e36271 --- /dev/null +++ b/t/setting.t @@ -0,0 +1,14 @@ +#! /usr/bin/env perl6 + +use v6.c; +use Test; +use lib "lib"; + +plan 2; + +use Config; + +my $config = Config.new(); + +ok $config.set("a", "test").get("a") eq "test"; +ok $config.set("b.c", "test").get("b.c") eq "test"; |