mirror of
https://github.com/mbierlee/mirage-config.git
synced 2024-11-14 20:34:00 +01:00
Get rid of empty segments in config path
This commit is contained in:
parent
70301442a2
commit
7d7dd9a328
|
@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue