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/02-getting.t | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 t/02-getting.t (limited to 't/02-getting.t') diff --git a/t/02-getting.t b/t/02-getting.t new file mode 100644 index 0000000..06a345a --- /dev/null +++ b/t/02-getting.t @@ -0,0 +1,28 @@ +#! /usr/bin/env perl6 + +use v6.c; +use Test; +use lib "lib"; + +plan 8; + +use Config; + +my $config = Config.new(); + +$config.read({ + a => "a", + b => { + c => "c" + } +}); + +ok $config.get("a") eq "a", "Get simple key"; +ok $config.get("b.c") eq "c", "Get nested key"; +ok $config.get("nonexistant") === Nil, "Get nonexistant key"; +ok $config.get("nonexistant", "test") === "test", "Get nonexistant key with default"; + +ok $config.get(["a"]) eq "a", "Get simple key by array"; +ok $config.get(["b", "c"]) eq "c", "Get nested key by array"; +ok $config.get(["nonexistant"]) === Nil, "Get nonexistant key by array"; +ok $config.get(["nonexistant"], "test") === "test", "Get nonexistant key by array with default"; -- cgit v1.1