Add workaround for SnakeYAML 100 comment limit

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot
2022-01-04 09:25:20 +11:00
parent 4fd0026eb5
commit 7aec97546b
3 changed files with 94 additions and 1 deletions

View File

@@ -144,4 +144,23 @@ public class YamlConfigurationTest extends FileConfigurationTest {
+ " height-offset: 2\n";
assertEquals(expected, config.saveToString());
}
@Test
public void test100Comments() throws InvalidConfigurationException {
StringBuilder commentBuilder = new StringBuilder();
for (int i = 0; i < 100; i++) {
commentBuilder.append("# Comment ").append(i).append("\n");
}
final String data = ""
+ commentBuilder
+ "simpleKey: simpleValue\n"
+ "\n";
YamlConfiguration config = getConfig();
config.loadFromString(data);
String result = config.saveToString();
assertEquals(data, result);
}
}