mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 16:54:04 +00:00
Comment only documented settings
This commit is contained in:
1 parent
4141c0bead
commit
eb83541871
2 files changed
+18
-1
No files matched your search
@@ -2,6 +2,8 @@ package art.arcane.iris.configuration;
|
||||
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.iris.spi.IrisPlatforms;
|
||||
import art.arcane.volmlib.util.config.ConfigComments;
|
||||
import art.arcane.volmlib.util.config.ConfigExposePolicy;
|
||||
import art.arcane.volmlib.util.config.TomlCodec;
|
||||
|
||||
import java.io.File;
|
||||
@@ -49,7 +51,7 @@ public final class IrisSettingsFile {
|
||||
}
|
||||
|
||||
static String render(IrisSettings settings) {
|
||||
return TomlCodec.toToml(settings, SOURCE_TAG);
|
||||
return TomlCodec.toToml(settings, SOURCE_TAG, ConfigExposePolicy.ALL, ConfigComments.ANNOTATED_ONLY);
|
||||
}
|
||||
|
||||
private static IrisSettings loadExisting(File file) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.junit.rules.TemporaryFolder;
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.attribute.FileTime;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
@@ -116,4 +117,18 @@ public class IrisSettingsFileTest {
|
||||
+ "# Effect: The -Diris.strictContent system property overrides this.\n"
|
||||
+ "strictContentKeys = false\n"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void undocumentedSettingsHaveNoComment() {
|
||||
String rendered = IrisSettingsFile.render(new IrisSettings());
|
||||
|
||||
assertFalse(lineBefore(rendered, "debug = false").startsWith("#"));
|
||||
}
|
||||
|
||||
private static String lineBefore(String text, String line) {
|
||||
List<String> lines = text.lines().toList();
|
||||
int index = lines.indexOf(line);
|
||||
assertTrue(index > 0);
|
||||
return lines.get(index - 1);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user