From fea344faa485c49ad22817e2e836ca2fa352a2dc Mon Sep 17 00:00:00 2001 From: Ilya Chernikov Date: Mon, 20 Mar 2023 10:10:48 +0100 Subject: [PATCH] Test infra: fix regexes relying on \n line endings --- .../test/preprocessors/JspecifyMarksCleanupPreprocessor.kt | 2 +- .../tests/org/jetbrains/kotlin/test/TestFiles.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/preprocessors/JspecifyMarksCleanupPreprocessor.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/preprocessors/JspecifyMarksCleanupPreprocessor.kt index c47c413dbca..ff957facb97 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/preprocessors/JspecifyMarksCleanupPreprocessor.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/preprocessors/JspecifyMarksCleanupPreprocessor.kt @@ -14,6 +14,6 @@ class JspecifyMarksCleanupPreprocessor(testServices: TestServices) : SourceFileP companion object { private val jspecifyMarks = diagnosticsToJspecifyMarks.values.map { it.values }.flatten().joinToString("|") - private val regexToCleanup = Regex("""[ ]*// ($jspecifyMarks)(, ($jspecifyMarks))*\n""") + private val regexToCleanup = Regex("""[ ]*// ($jspecifyMarks)(, ($jspecifyMarks))*(?:\r\n|\n)""") } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestFiles.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestFiles.java index 80cd3e18a47..2aee85628b5 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestFiles.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestFiles.java @@ -33,12 +33,12 @@ public class TestFiles { */ private static final String MODULE_DELIMITER = ",\\s*"; - private static final Pattern MODULE_PREFIX_PATTERN = Pattern.compile("//\\s*MODULE:.*\n"); + private static final Pattern MODULE_PREFIX_PATTERN = Pattern.compile("//\\s*MODULE:.*(?:\\r\\n|\\n)"); private static final Pattern MODULE_PATTERN = Pattern.compile("//\\s*MODULE:\\s*([^()\\n]+)" + // name "(?:\\(([^()]*(?:" + MODULE_DELIMITER + "[^()]+)*)\\))?\\s*" + // dependencies "(?:\\(([^()]*(?:" + MODULE_DELIMITER + "[^()]+)*)\\))?\\s*" + // friends - "(?:\\(([^()]*(?:" + MODULE_DELIMITER + "[^()]+)*)\\))?\n"); // dependsOn - private static final Pattern FILE_PATTERN = Pattern.compile("//\\s*FILE:\\s*(.*)\n"); + "(?:\\(([^()]*(?:" + MODULE_DELIMITER + "[^()]+)*)\\))?(?:\\r\\n|\\n)"); // dependsOn + private static final Pattern FILE_PATTERN = Pattern.compile("//\\s*FILE:\\s*(.*)(?:\\r\\n|\\n)"); private static final Pattern LINE_SEPARATOR_PATTERN = Pattern.compile("\\r\\n|\\r|\\n");