diff --git a/CodeStyleAndFormatting/ConfigureCodeStyleSettingsInIDE/.editorconfig b/CodeStyleAndFormatting/ConfigureCodeStyleSettingsInIDE/.editorconfig index 6b356dd..41527dd 100644 --- a/CodeStyleAndFormatting/ConfigureCodeStyleSettingsInIDE/.editorconfig +++ b/CodeStyleAndFormatting/ConfigureCodeStyleSettingsInIDE/.editorconfig @@ -1,3 +1,5 @@ [*] indent_size = 4 -indent_style = space \ No newline at end of file +indent_style = space +max_line_length = 120 +insert_final_newline = true diff --git a/CodeStyleAndFormatting/ConfigureCodeStyleSettingsInIDE/task-info.yaml b/CodeStyleAndFormatting/ConfigureCodeStyleSettingsInIDE/task-info.yaml index d81957e..0c3130e 100644 --- a/CodeStyleAndFormatting/ConfigureCodeStyleSettingsInIDE/task-info.yaml +++ b/CodeStyleAndFormatting/ConfigureCodeStyleSettingsInIDE/task-info.yaml @@ -20,7 +20,7 @@ files: visible: true placeholders: - offset: 0 - length: 40 + length: 91 placeholder_text: "" - name: test/EditorconfigTest.kt visible: false diff --git a/CodeStyleAndFormatting/ConfigureCodeStyleSettingsInIDE/test/EditorconfigTest.kt b/CodeStyleAndFormatting/ConfigureCodeStyleSettingsInIDE/test/EditorconfigTest.kt index c5b3fd5..a1f4cb8 100644 --- a/CodeStyleAndFormatting/ConfigureCodeStyleSettingsInIDE/test/EditorconfigTest.kt +++ b/CodeStyleAndFormatting/ConfigureCodeStyleSettingsInIDE/test/EditorconfigTest.kt @@ -1,3 +1,4 @@ +import org.ini4j.Ini import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.BeforeAll import org.junit.jupiter.api.Test @@ -26,12 +27,18 @@ class EditorconfigTest { @Test fun editorconfigFileContentTest() { - val sourceText = editorconfigFile.readText() - val expectedText = """ - [*] - indent_size = 4 - indent_style = space - """.trimIndent() - Assertions.assertEquals(expectedText, sourceText) + val ini = Ini(editorconfigFile) + Assertions.assertEquals("4", ini.get("*")?.get("indent_size")) { + "Please, define the settings so that the indentation size is equal to 4" + } + Assertions.assertEquals("space", ini.get("*")?.get("indent_style")) { + "Please, define the settings so that the indentation style is equal to space" + } + Assertions.assertEquals("120", ini.get("*")?.get("max_line_length")) { + "Please, define the settings so that the maximum line length is equal to 120" + } + Assertions.assertEquals("true", ini.get("*")?.get("insert_final_newline")) { + "Please, define the settings so that a newline character is added at the end of the last line in the file" + } } } diff --git a/build.gradle.kts b/build.gradle.kts index 2e8de43..6b7e4be 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -65,6 +65,8 @@ allprojects { runtimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion") implementation("org.junit.jupiter:junit-jupiter-params:$junitJupiterVersion") runtimeOnly("org.junit.platform:junit-platform-console:1.9.0") + + implementation("org.ini4j:ini4j:0.5.4") } tasks {