From cfe2b133a952945c24879118fc5f0aed16c3c0cf Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Sat, 29 Jul 2017 03:04:12 +0200 Subject: Clean up all tests --- t/01-reading.t | 2 +- t/02-getting.t | 20 ++++++++++---------- t/03-having.t | 2 +- t/04-setting.t | 8 ++++---- t/05-null-parser.t | 2 +- t/06-deduce-parser.t | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) (limited to 't') diff --git a/t/01-reading.t b/t/01-reading.t index 07e92c3..f7bf7d4 100644 --- a/t/01-reading.t +++ b/t/01-reading.t @@ -8,7 +8,7 @@ plan 5; use Config; -my $config = Config.new(); +my Config $config = Config.new(); throws-like { $config.read("t/files/none") }, Config::Exception::FileNotFoundException, "Reading nonexisting file"; throws-like { $config.read("t/files/config", "Config::Parser:NoSuchParserForTest") }, Config::Exception::MissingParserException, "Using non-existing parser"; diff --git a/t/02-getting.t b/t/02-getting.t index 8645607..adff4ff 100644 --- a/t/02-getting.t +++ b/t/02-getting.t @@ -8,7 +8,7 @@ plan 13; use Config; -my $config = Config.new(); +my Config $config = Config.new(); $config.read({ a => "a", @@ -17,19 +17,19 @@ $config.read({ } }); -ok $config.get("a") eq "a", "Get simple key"; -ok $config.get("b.c") eq "c", "Get nested key"; +is $config.get("a"), "a", "Get simple key"; +is $config.get("b.c"), "c", "Get nested key"; +is $config.get("nonexistant", "test"), "test", "Get nonexistant key with default"; 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"; +is $config.get(["a"]), "a", "Get simple key by array"; +is $config.get(["b", "c"]), "c", "Get nested key by array"; +is $config.get(["nonexistant"], "test"), "test", "Get nonexistant key by array with default"; ok $config.get(["nonexistant"]) === Nil, "Get nonexistant key by array"; -ok $config.get(["nonexistant"], "test") === "test", "Get nonexistant key by array with default"; -ok $config. eq "a", "Get simple key via associative index"; -ok $config. eq "c", "Get nested key via associative index"; +is $config., "a", "Get simple key via associative index"; +is $config., "c", "Get nested key via associative index"; ok $config. === Nil, "Get nonexistant key via associative index"; -is $config.get(Nil), Nil, "Attempt to .get with Nil key"; is $config.get(Nil, "test"), "test", "Attempt .get with Nil key with default"; +ok $config.get(Nil) === Nil, "Attempt to .get with Nil key"; diff --git a/t/03-having.t b/t/03-having.t index 0627ed5..3708d8e 100644 --- a/t/03-having.t +++ b/t/03-having.t @@ -8,7 +8,7 @@ plan 4; use Config; -my $config = Config.new(); +my Config $config = Config.new(); $config.read({ a => "a", diff --git a/t/04-setting.t b/t/04-setting.t index 7e3a457..77039ca 100644 --- a/t/04-setting.t +++ b/t/04-setting.t @@ -10,7 +10,7 @@ use Config; my $config = Config.new(); -ok $config.set("a", "test").get("a") eq "test", "Setting simple key"; -ok $config.set("b.c", "test").get("b.c") eq "test", "Setting nested key"; -ok $config.set(["d"], "test").get("d") eq "test", "Setting simple key using array"; -ok $config.set(["e", "f"], "test").get("e.f") eq "test", "Setting nested key using array"; +is $config.set("a", "test").get("a"), "test", "Setting simple key"; +is $config.set("b.c", "test").get("b.c"), "test", "Setting nested key"; +is $config.set(["d"], "test").get("d"), "test", "Setting simple key using array"; +is $config.set(["e", "f"], "test").get("e.f"), "test", "Setting nested key using array"; diff --git a/t/05-null-parser.t b/t/05-null-parser.t index 97e897f..7ba1826 100644 --- a/t/05-null-parser.t +++ b/t/05-null-parser.t @@ -16,7 +16,7 @@ plan 3; } }); -my $config = Config.new(); +my Config $config = Config.new(); ok $config.read("t/files/config", "Config::Parser::NULL"), "Attempt to read a file with Config::Parser::NULL"; diff --git a/t/06-deduce-parser.t b/t/06-deduce-parser.t index 2811d19..5c39729 100644 --- a/t/06-deduce-parser.t +++ b/t/06-deduce-parser.t @@ -8,7 +8,7 @@ use Config; plan 4; -my $config = Config.new; +my Config $config = Config.new(); subtest "Unknown parser type" => { plan 1; -- cgit v1.1