mirror of
https://github.com/mbierlee/mirage-config.git
synced 2024-11-15 04:44:01 +01:00
Add additional tests
This commit is contained in:
parent
16b430a135
commit
70301442a2
|
@ -381,4 +381,30 @@ version (unittest) {
|
|||
assertThrown!ConfigReadException(dictionary.get("hostname"));
|
||||
}
|
||||
|
||||
@("Get value from objects in array")
|
||||
unittest {
|
||||
auto dictionary = new ConfigDictionary();
|
||||
dictionary.rootNode = new ArrayNode(
|
||||
new ObjectNode(["wrong": "yes"]),
|
||||
new ObjectNode(["wrong": "no"]),
|
||||
new ObjectNode(["wrong": "very"]),
|
||||
);
|
||||
|
||||
assert(dictionary.get("[1].wrong") == "no");
|
||||
}
|
||||
|
||||
@("Get value from config with mixed types")
|
||||
unittest {
|
||||
auto dictionary = new ConfigDictionary();
|
||||
dictionary.rootNode = new ObjectNode([
|
||||
"uno": cast(ConfigNode) new ValueNode("one"),
|
||||
"dos": cast(ConfigNode) new ArrayNode(["nope", "two"]),
|
||||
"tres": cast(ConfigNode) new ObjectNode(["thisone": "three"])
|
||||
]);
|
||||
|
||||
assert(dictionary.get("uno") == "one");
|
||||
assert(dictionary.get("dos.[1]") == "two");
|
||||
assert(dictionary.get("tres.thisone") == "three");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue