mirror of
https://github.com/lightbend/config.git
synced 2025-02-23 09:41:01 +08:00
Merge pull request #88 from typesafehub/havocp-comment-spaces
Don't add multiple spaces in front of comments, fixes #87
This commit is contained in:
commit
e85a54e4a1
@ -390,7 +390,9 @@ final class SimpleConfigObject extends AbstractConfigObject implements Serializa
|
|||||||
if (options.getComments()) {
|
if (options.getComments()) {
|
||||||
for (String comment : v.origin().comments()) {
|
for (String comment : v.origin().comments()) {
|
||||||
indent(sb, indent + 1, options);
|
indent(sb, indent + 1, options);
|
||||||
sb.append("# ");
|
sb.append("#");
|
||||||
|
if (!comment.startsWith(" "))
|
||||||
|
sb.append(' ');
|
||||||
sb.append(comment);
|
sb.append(comment);
|
||||||
sb.append("\n");
|
sb.append("\n");
|
||||||
}
|
}
|
||||||
|
@ -1059,6 +1059,15 @@ class ConfigTest extends TestUtils {
|
|||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// rendering repeatedly should not make the file different (e.g. shouldn't make it longer)
|
||||||
|
// unless the debug comments are in there
|
||||||
|
if (!renderOptions.getOriginComments()) {
|
||||||
|
val renderedAgain = resolvedParsed.root.render(renderOptions)
|
||||||
|
// TODO the strings should be THE SAME not just the same length,
|
||||||
|
// but there's a bug right now that sometimes object keys seem to
|
||||||
|
// be re-ordered. Need to fix.
|
||||||
|
assertEquals("render changed, resolved options=" + renderOptions, resolvedRender.length, renderedAgain.length)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user