mirror of
https://github.com/mbierlee/mirage-config.git
synced 2024-11-15 04:44:01 +01:00
Trim key/value in java props
This commit is contained in:
parent
40a20ca3ff
commit
34e78be898
|
@ -43,7 +43,7 @@ class JavaPropertiesFactory : ConfigFactory {
|
||||||
enforce!ConfigCreationException(parts.length <= 2, "Line has too many equals signs and cannot be parsed (L" ~ index
|
enforce!ConfigCreationException(parts.length <= 2, "Line has too many equals signs and cannot be parsed (L" ~ index
|
||||||
.to!string ~ "): " ~ trimmedLine);
|
.to!string ~ "): " ~ trimmedLine);
|
||||||
enforce!ConfigCreationException(parts.length == 2, "Missing value assignment (L" ~ index.to!string ~ "): " ~ trimmedLine);
|
enforce!ConfigCreationException(parts.length == 2, "Missing value assignment (L" ~ index.to!string ~ "): " ~ trimmedLine);
|
||||||
properties.set(parts[0], parts[1]);
|
properties.set(parts[0].strip, parts[1].strip);
|
||||||
}
|
}
|
||||||
|
|
||||||
return properties;
|
return properties;
|
||||||
|
@ -122,4 +122,13 @@ version (unittest) {
|
||||||
|
|
||||||
assert(config.get("two") == "money");
|
assert(config.get("two") == "money");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@("Values and keys are trimmed")
|
||||||
|
unittest {
|
||||||
|
auto config = parseJavaProperties("
|
||||||
|
one = money
|
||||||
|
");
|
||||||
|
|
||||||
|
assert(config.get("one") == "money");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue