diff --git a/source/poodinis/config/dictionary.d b/source/poodinis/config/dictionary.d index b222776..826d775 100644 --- a/source/poodinis/config/dictionary.d +++ b/source/poodinis/config/dictionary.d @@ -113,7 +113,12 @@ class ConfigPath { this(const string path) { this.path = path; - this.segments = path.split("."); + + foreach (segment; path.split(".")) { + if (segment.length > 0) { + segments ~= segment; + } + } } PathSegment getNextSegment() { @@ -407,4 +412,15 @@ version (unittest) { assert(dictionary.get("tres.thisone") == "three"); } + @("Ignore empty segments") + unittest { + auto dictionary = new ConfigDictionary(); + dictionary.rootNode = new ObjectNode( + [ + "one": new ObjectNode(["two": new ObjectNode(["three": "four"])]) + ]); + + assert(dictionary.get(".one..two...three....") == "four"); + } + }