make Path.render() properly handle empty string path elements

This commit is contained in:
Havoc Pennington 2011-11-25 15:39:41 -05:00
parent 21d9b8b358
commit 7c55d91149
2 changed files with 2 additions and 1 deletions

View File

@ -152,7 +152,7 @@ final class Path {
}
private void appendToStringBuilder(StringBuilder sb) {
if (hasFunkyChars(first))
if (hasFunkyChars(first) || first.isEmpty())
sb.append(ConfigUtil.renderJsonString(first));
else
sb.append(first);

View File

@ -46,6 +46,7 @@ class PathTest extends TestUtils {
assertEquals("foo.\"bar*\"", path("foo", "bar*").render())
assertEquals("\"foo.bar\"", path("foo.bar").render())
assertEquals("foo bar", path("foo bar").render())
assertEquals("\"\".\"\"", path("", "").render())
}
@Test