Consistent indentation with spaces rather than tabs (#6147)

This commit is contained in:
Basil Crow authored and GitHub committed 2022-01-01 11:45:56 -08:00
1 parent 0303e31890
commit 02eecd8a49
26 files changed
+420 -417

No files matched your search

+34 -34
View File
@@ -100,7 +100,7 @@ public class UtilTest {
assertEquals("a.B", Util.replaceMacro("$A.B", m));
assertEquals("a-b", Util.replaceMacro("${A.B}", m));
// test that more complex scenarios work
// test that more complex scenarios work
assertEquals("/a/B/aa", Util.replaceMacro("/$A/$B/$AA",m));
assertEquals("a-aa", Util.replaceMacro("$A-$AA",m));
assertEquals("/a/foo/can/B/you-believe_aa~it?", Util.replaceMacro("/$A/foo/can/$B/you-believe_$AA~it?",m));
@@ -354,50 +354,50 @@ public class UtilTest {
@Issue("JENKINS-10346")
@Test
public void testDigestThreadSafety() throws InterruptedException {
String a = "abcdefgh";
String b = "123456789";
String a = "abcdefgh";
String b = "123456789";
String digestA = Util.getDigestOf(a);
String digestB = Util.getDigestOf(b);
String digestA = Util.getDigestOf(a);
String digestB = Util.getDigestOf(b);
DigesterThread t1 = new DigesterThread(a, digestA);
DigesterThread t2 = new DigesterThread(b, digestB);
DigesterThread t1 = new DigesterThread(a, digestA);
DigesterThread t2 = new DigesterThread(b, digestB);
t1.start();
t2.start();
t1.start();
t2.start();
t1.join();
t2.join();
t1.join();
t2.join();
if (t1.error != null) {
fail(t1.error);
}
if (t2.error != null) {
fail(t2.error);
}
if (t1.error != null) {
fail(t1.error);
}
if (t2.error != null) {
fail(t2.error);
}
}
private static class DigesterThread extends Thread {
private String string;
private String expectedDigest;
private String string;
private String expectedDigest;
private String error;
private String error;
DigesterThread(String string, String expectedDigest) {
this.string = string;
this.expectedDigest = expectedDigest;
}
DigesterThread(String string, String expectedDigest) {
this.string = string;
this.expectedDigest = expectedDigest;
}
@Override
public void run() {
for (int i=0; i < 1000; i++) {
String digest = Util.getDigestOf(this.string);
if (!this.expectedDigest.equals(digest)) {
this.error = "Expected " + this.expectedDigest + ", but got " + digest;
break;
}
}
}
@Override
public void run() {
for (int i=0; i < 1000; i++) {
String digest = Util.getDigestOf(this.string);
if (!this.expectedDigest.equals(digest)) {
this.error = "Expected " + this.expectedDigest + ", but got " + digest;
break;
}
}
}
}
@Test
@@ -8,26 +8,26 @@ import org.junit.Test;
public class Maven3MojoNoteTest {
@Test
public void testAnnotateMavenPlugin() {
check("[INFO] <b class=maven-mojo>--- maven-clean-plugin:2.4.1:clean (default-clean) @ jobConfigHistory ---</b>", "[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ jobConfigHistory ---");
}
@Test
public void testAnnotateMavenPlugin() {
check("[INFO] <b class=maven-mojo>--- maven-clean-plugin:2.4.1:clean (default-clean) @ jobConfigHistory ---</b>", "[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ jobConfigHistory ---");
}
@Test
public void testAnnotateCodehausPlugin() {
check("[INFO] <b class=maven-mojo>--- cobertura-maven-plugin:2.4:instrument (report:cobertura) @ sardine ---</b>", "[INFO] --- cobertura-maven-plugin:2.4:instrument (report:cobertura) @ sardine ---");
@Test
public void testAnnotateCodehausPlugin() {
check("[INFO] <b class=maven-mojo>--- cobertura-maven-plugin:2.4:instrument (report:cobertura) @ sardine ---</b>", "[INFO] --- cobertura-maven-plugin:2.4:instrument (report:cobertura) @ sardine ---");
}
}
@Test
public void testAnnotateOtherPlugin() {
check("[INFO] <b class=maven-mojo>--- gmaven-plugin:1.0-rc-5:generateTestStubs (test-in-groovy) @ jobConfigHistory ---</b>", "[INFO] --- gmaven-plugin:1.0-rc-5:generateTestStubs (test-in-groovy) @ jobConfigHistory ---");
}
@Test
public void testAnnotateOtherPlugin() {
check("[INFO] <b class=maven-mojo>--- gmaven-plugin:1.0-rc-5:generateTestStubs (test-in-groovy) @ jobConfigHistory ---</b>", "[INFO] --- gmaven-plugin:1.0-rc-5:generateTestStubs (test-in-groovy) @ jobConfigHistory ---");
}
private void check(final String decorated, final String input) {
assertTrue(input + " does not match" + Maven3MojoNote.PATTERN, Maven3MojoNote.PATTERN.matcher(input).matches());
assertEquals(decorated, annotate(input));
}
private void check(final String decorated, final String input) {
assertTrue(input + " does not match" + Maven3MojoNote.PATTERN, Maven3MojoNote.PATTERN.matcher(input).matches());
assertEquals(decorated, annotate(input));
}
private String annotate(String text) {
final MarkupText markupText = new MarkupText(text);
+39 -39
View File
@@ -37,53 +37,53 @@ import org.jvnet.hudson.test.Issue;
*/
public class RunListTest {
// RunList for byTimestamp tests
private RunList rlist;
// RunList for byTimestamp tests
private RunList rlist;
// RunList<Run> is ordered from most to least recent
private void setUpByTimestampRuns() {
Run r1 = mock(Run.class);
Run r2 = mock(Run.class);
// RunList<Run> is ordered from most to least recent
private void setUpByTimestampRuns() {
Run r1 = mock(Run.class);
Run r2 = mock(Run.class);
when(r1.getNumber()).thenReturn(1);
when(r2.getNumber()).thenReturn(2);
when(r1.getNumber()).thenReturn(1);
when(r2.getNumber()).thenReturn(2);
when(r1.getTimeInMillis()).thenReturn(200L);
when(r2.getTimeInMillis()).thenReturn(300L);
when(r1.getTimeInMillis()).thenReturn(200L);
when(r2.getTimeInMillis()).thenReturn(300L);
ArrayList<Run> list = new ArrayList<>();
list.add(r2);
list.add(r1);
ArrayList<Run> list = new ArrayList<>();
list.add(r2);
list.add(r1);
rlist = RunList.fromRuns(list);
}
rlist = RunList.fromRuns(list);
}
@Test
public void byTimestampAllRuns() {
setUpByTimestampRuns();
@Test
public void byTimestampAllRuns() {
setUpByTimestampRuns();
RunList<Run> tested = rlist.byTimestamp(0, 400);
assertEquals(2, tested.toArray().length);
}
RunList<Run> tested = rlist.byTimestamp(0, 400);
assertEquals(2, tested.toArray().length);
}
@Issue("JENKINS-21159")
@Test
@SuppressWarnings("deprecation")
public void byTimestampFirstRun() {
setUpByTimestampRuns();
// Only r1
RunList<Run> tested = rlist.byTimestamp(150, 250);
assertEquals(1, tested.toArray().length);
assertEquals(1, tested.getFirstBuild().getNumber());
}
@Test
@SuppressWarnings("deprecation")
public void byTimestampFirstRun() {
setUpByTimestampRuns();
// Only r1
RunList<Run> tested = rlist.byTimestamp(150, 250);
assertEquals(1, tested.toArray().length);
assertEquals(1, tested.getFirstBuild().getNumber());
}
@Test
@SuppressWarnings("deprecation")
public void byTimestampLastRun() {
setUpByTimestampRuns();
// Only r2
RunList<Run> tested = rlist.byTimestamp(250, 350);
assertEquals(1, tested.toArray().length);
assertEquals(2, tested.getFirstBuild().getNumber());
}
@Test
@SuppressWarnings("deprecation")
public void byTimestampLastRun() {
setUpByTimestampRuns();
// Only r2
RunList<Run> tested = rlist.byTimestamp(250, 350);
assertEquals(1, tested.toArray().length);
assertEquals(2, tested.getFirstBuild().getNumber());
}
}