Add null value test

This commit is contained in:
Mike Bierlee 2022-09-28 23:35:10 +03:00
parent f0d5f34390
commit 8389d75958

View file

@ -350,7 +350,7 @@ class ConfigDictionary {
private string substituteEnvVars(ValueNode valueNode) { private string substituteEnvVars(ValueNode valueNode) {
auto value = valueNode.value; auto value = valueNode.value;
if (value == null) { if (value == null) {
return value; //todo test return value;
} }
auto result = ""; auto result = "";
@ -707,6 +707,12 @@ version (unittest) {
assert(config.get("bla") == " blergh "); assert(config.get("bla") == " blergh ");
} }
@("Null value stays null, not string")
unittest {
auto config = new ConfigDictionary(new ValueNode(null));
assert(config.get(".") == null);
}
@("Read value from environment variable") @("Read value from environment variable")
unittest { unittest {
environment["MIRAGE_CONFIG_TEST_ENV_VAR"] = "is set!"; environment["MIRAGE_CONFIG_TEST_ENV_VAR"] = "is set!";