Skip to content

Commit 21e4024

Browse files
authored
Handle newlines in release notes test (#130134) (#130350)
Newlines are system dependent. The release notes generator uses groovy's template engine, which produces system dependent newlines. This commit adjusts the test to account for newlines on both windows and nix systems.
1 parent 04c1ebf commit 21e4024

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

build-tools-internal/src/test/java/org/elasticsearch/gradle/internal/release/ReleaseNotesGeneratorTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.util.Objects;
2020

2121
import static org.elasticsearch.gradle.internal.release.GenerateReleaseNotesTask.getSortedBundlesWithUniqueChangelogs;
22+
import static org.hamcrest.Matchers.arrayContaining;
2223
import static org.hamcrest.Matchers.equalTo;
2324
import static org.junit.Assert.assertFalse;
2425
import static org.junit.Assert.assertThat;
@@ -100,7 +101,10 @@ public void testTemplate(String templateFilename, String outputFilename, List<Ch
100101
writeResource(outputFile, actualOutput);
101102
assertFalse("UPDATE_EXPECTED_OUTPUT should be set back to false after updating output", UPDATE_EXPECTED_OUTPUT);
102103
} else {
103-
assertThat(actualOutput, equalTo(expectedOutput));
104+
String[] expectedLines = expectedOutput.replace("\r", "").split("\n");
105+
String[] actualLines = actualOutput.split("\n");
106+
107+
assertThat(actualLines, arrayContaining(expectedLines));
104108
}
105109
}
106110

0 commit comments

Comments
 (0)