Skip to content

Commit 38cc476

Browse files
authored
Merge branch 'master' into logging-exMTL
2 parents 89bbd40 + 7fc878b commit 38cc476

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

lib/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
</build>
7474

7575
<properties>
76-
<groovy-sandbox.version>1.33</groovy-sandbox.version>
76+
<groovy-sandbox.version>1.34</groovy-sandbox.version>
7777
<no-test-jar>false</no-test-jar>
7878
</properties>
7979
<dependencies>

lib/src/test/java/com/cloudbees/groovy/cps/sandbox/SandboxInvokerTest.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,16 @@ public void assertEvaluate(Object expectedReturnValue, String script) {
8989
// TODO: Refactor things so we can check evalCps as well.
9090
}
9191

92-
public void assertIntercept(String script, Object expectedResult, String... expectedInterceptions) throws Throwable {
92+
public void assertIntercept(String script, Object expectedResult, String... expectedCalls) throws Throwable {
9393
assertEvaluate(expectedResult, script);
94-
ec.checkThat(cr.toString().split("\n"), equalTo(expectedInterceptions));
94+
String[] updatedExpectedCalls = expectedCalls;
95+
// Insert SerializableScript constructor call automatically to avoid having to update all tests.
96+
if (expectedCalls.length == 0 || (expectedCalls.length > 0 && !expectedCalls[0].equals("new SerializableScript()"))) {
97+
updatedExpectedCalls = new String[expectedCalls.length + 1];
98+
updatedExpectedCalls[0] = "new SerializableScript()";
99+
System.arraycopy(expectedCalls, 0, updatedExpectedCalls, 1, expectedCalls.length);
100+
}
101+
ec.checkThat(cr.toString().split("\n"), equalTo(updatedExpectedCalls));
95102
}
96103

97104
/**
@@ -566,7 +573,8 @@ public void nonCpsfinalizerForbidden() throws Throwable {
566573
null,
567574
"Script1.super(Script1).setBinding(Binding)",
568575
"new Test()",
569-
"System:getProperties()");
576+
"System:getProperties()",
577+
"new Test(Properties)");
570578
}
571579

572580
@Ignore("Initial expressions for parameters in CPS-transformed closures are currently ignored")
@@ -636,6 +644,7 @@ public void sandboxInterceptsImplicitCastsArrayAssignment() throws Throwable {
636644
"Script3.super(Script3).setBinding(Binding)",
637645
"new Test()",
638646
"new File(String)",
647+
"new Test(File)",
639648
"Test.x");
640649
}
641650

plugin/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
<dependency>
8181
<groupId>org.jenkins-ci.plugins</groupId>
8282
<artifactId>script-security</artifactId>
83+
<version>1336.vf33a_a_9863911</version>
8384
</dependency>
8485
<dependency>
8586
<groupId>org.jenkins-ci.plugins</groupId>

0 commit comments

Comments
 (0)