Skip to content

Commit aa36423

Browse files
committed
Replace emojis in parameterized test display name
This change replaces smiley emojis with ascii, in new parameterized tests for console line wrapping. This hopefully avoids confusing GitHub jobs. In addition, emojis in IOConsoleTests are replaced with unicode codepoints. See: #2650
1 parent ca6b952 commit aa36423

3 files changed

Lines changed: 34 additions & 8 deletions

File tree

debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleOutputLineTruncateTest.java

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

2121
import org.eclipse.ui.internal.console.ConsoleOutputLineTruncate;
22+
import org.junit.jupiter.api.Named;
2223
import org.junit.jupiter.params.ParameterizedTest;
2324
import org.junit.jupiter.params.provider.Arguments;
2425
import org.junit.jupiter.params.provider.MethodSource;
@@ -114,7 +115,7 @@ private static Parameters test(int limit, int chunks, int repeat, String input,
114115
};
115116

116117
private static Stream<Arguments> tests() {
117-
return Arrays.stream(TESTS).map(Arguments::of);
118+
return Arrays.stream(TESTS).map(ConsoleOutputLineTruncateTest::named);
118119
}
119120

120121
@ParameterizedTest
@@ -134,4 +135,11 @@ public void test(Parameters p) {
134135
private static String repeat(String s, int r, String nl) {
135136
return (nl + s).repeat(r).substring(nl.length());
136137
}
138+
139+
private static Arguments named(Parameters p) {
140+
String name = "limit=" + p.limit + ", chunks=" + p.chunks + ", repeat=" + p.repeat +
141+
", input=" + ConsoleOutputLineWrapTest.replaceSmiley(p.input) +
142+
", output" + ConsoleOutputLineWrapTest.replaceSmiley(p.output);
143+
return Arguments.of(Named.of(name, p));
144+
}
137145
}

debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleOutputLineWrapTest.java

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

2121
import org.eclipse.ui.internal.console.ConsoleOutputLineWrap;
22+
import org.junit.jupiter.api.Named;
2223
import org.junit.jupiter.params.ParameterizedTest;
2324
import org.junit.jupiter.params.provider.Arguments;
2425
import org.junit.jupiter.params.provider.MethodSource;
@@ -127,7 +128,7 @@ private static Parameters test(int limit, int chunks, int repeat, String input,
127128
};
128129

129130
private static Stream<Arguments> tests() {
130-
return Arrays.stream(TESTS).map(Arguments::of);
131+
return Arrays.stream(TESTS).map(ConsoleOutputLineWrapTest::named);
131132
}
132133

133134
@ParameterizedTest
@@ -147,4 +148,21 @@ public void test(Parameters p) {
147148
private static String repeat(String s, int r, String nl) {
148149
return (nl + s).repeat(r).substring(nl.length());
149150
}
151+
152+
private static Arguments named(Parameters p) {
153+
String name = "limit=" + p.limit + ", chunks=" + p.chunks + ", repeat=" + p.repeat +
154+
", input=" + replaceSmiley(p.input) +
155+
", output" + replaceSmiley(p.output);
156+
return Arguments.of(Named.of(name, p));
157+
}
158+
159+
static String replaceSmiley(String s) {
160+
/**
161+
* We don't want emojis in test names, to avoid potentially breaking GitHub actions.
162+
* See: https://github.com/eclipse-platform/eclipse.platform/issues/2650
163+
*/
164+
String smiley = "\uD83D\uDE00";
165+
String ascii = ":)";
166+
return s.replaceAll(smiley, ascii);
167+
}
150168
}

debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -751,13 +751,13 @@ public void testTrimSurrogateCharacters() throws Exception {
751751
final IOConsoleTestUtil c = getTestUtil("Test trim newline");
752752
try (IOConsoleOutputStream out = c.getDefaultOutputStream()) {
753753
c.writeFast("first\n");
754-
c.writeFast("1😀2😀3\n", out);
754+
c.writeFast("1\uD83D\uDE002\uD83D\uDE003\n", out);
755755
c.write("last\n");
756756
c.verifyContentByLine("first", 0).verifyContentByLine("last", -2);
757757
assertTrue(c.getDocument().getNumberOfLines() > 2, "Document not filled.");
758758
c.getConsole().setWaterMarks(8, 16);
759759
c.waitForScheduledJobs();
760-
c.verifyContentByOffset("😀3\nlas", 0);
760+
c.verifyContentByOffset("\uD83D\uDE003\nlas", 0);
761761
closeConsole(c);
762762
}
763763
}
@@ -810,12 +810,12 @@ public void testTrimLongLineSurrogateCharacters() throws Exception {
810810
try (IOConsoleOutputStream out = c.getDefaultOutputStream()) {
811811
c.getConsole().setLimitLineLength(false, 8);
812812
c.writeFast("first\n");
813-
c.writeFast("01234😀😀😀\n", out);
813+
c.writeFast("01234\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\n", out);
814814
c.write("last\n");
815815
c.verifyContentByLine("first", 0).verifyContentByLine("last", -2);
816816
assertTrue(c.getDocument().getNumberOfLines() > 2, "Document not filled.");
817817
c.waitForScheduledJobs();
818-
c.verifyContent("first\n01234😀 ...\nlast\n");
818+
c.verifyContent("first\n01234\uD83D\uDE00 ...\nlast\n");
819819
closeConsole(c);
820820
}
821821
}
@@ -870,12 +870,12 @@ public void testWrapLongLineSurrogateCharacters() throws Exception {
870870
String nl = c.getConsole().getDocument().getLegalLineDelimiters()[0];
871871
c.getConsole().setLimitLineLength(true, 8);
872872
c.writeFast("first\n");
873-
c.writeFast("0123456😀😀\n", out);
873+
c.writeFast("0123456\uD83D\uDE00\uD83D\uDE00\n", out);
874874
c.write("last\n");
875875
c.verifyContentByLine("first", 0).verifyContentByLine("last", -2);
876876
assertTrue(c.getDocument().getNumberOfLines() > 2, "Document not filled.");
877877
c.waitForScheduledJobs();
878-
c.verifyContent("first\n0123456" + nl + "😀😀\nlast\n");
878+
c.verifyContent("first\n0123456" + nl + "\uD83D\uDE00\uD83D\uDE00\nlast\n");
879879
closeConsole(c);
880880
}
881881
}

0 commit comments

Comments
 (0)