From 1272ef1bc43ec629e163b4f745295dceabe8a383 Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Sat, 24 Sep 2022 17:09:20 +0300 Subject: [PATCH] Allow empty path just attempt to fetch the root --- source/mirage/config.d | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/mirage/config.d b/source/mirage/config.d index 64bf76d..94e3455 100644 --- a/source/mirage/config.d +++ b/source/mirage/config.d @@ -175,7 +175,7 @@ class ConfigDictionary { string get(string configPath) { enforce!ConfigReadException(rootNode !is null, "The config is empty"); - enforce!ConfigReadException(configPath.length > 0, "Supplied config path is empty"); + // enforce!ConfigReadException(configPath.length > 0, "Supplied config path is empty"); auto path = new ConfigPath(configPath); auto currentNode = rootNode; @@ -278,15 +278,15 @@ version (unittest) { assertThrown!ConfigReadException(dictionary.get(".")); } - @("Get value in dictionary with empty path fails") + @("Get value in root with empty path") unittest { auto dictionary = new ConfigDictionary(); dictionary.rootNode = new ValueNode("hehehe"); - assertThrown!ConfigReadException(dictionary.get("")); + assert(dictionary.get("") == "hehehe"); } - @("Get value in root") + @("Get value in root with just a dot") unittest { auto dictionary = new ConfigDictionary(); dictionary.rootNode = new ValueNode("yup");