mirror of
https://github.com/mbierlee/mirage-config.git
synced 2024-11-15 04:44:01 +01:00
Allow empty path
just attempt to fetch the root
This commit is contained in:
parent
bcd9bf22e3
commit
1272ef1bc4
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue