Skip to content

Commit

Permalink
[JENKINS-26481] Verifying that we can still pass closures to function…
Browse files Browse the repository at this point in the history
…s defined in load’d scripts.
  • Loading branch information
jglick committed Jun 9, 2016
1 parent 62a8792 commit 4266f0c
Showing 1 changed file with 7 additions and 3 deletions.
Expand Up @@ -7,9 +7,11 @@
import org.jenkinsci.plugins.workflow.job.WorkflowRun;
import org.jenkinsci.plugins.workflow.test.steps.SemaphoreStep;
import static org.junit.Assert.*;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runners.model.Statement;
import org.jvnet.hudson.test.BuildWatcher;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.RestartableJenkinsRule;

Expand All @@ -19,6 +21,8 @@
* @author Kohsuke Kawaguchi
*/
public class RestartingLoadStepTest {

@ClassRule public static BuildWatcher buildWatcher = new BuildWatcher();
@Rule public RestartableJenkinsRule story = new RestartableJenkinsRule();

@Inject
Expand All @@ -34,8 +38,8 @@ public void persistenceOfLoadedScripts() throws Exception {
WorkflowJob p = jenkins.createProject(WorkflowJob.class, "p");
jenkins.getWorkspaceFor(p).child("test.groovy").write(
"def answer(i) { return i*2; }\n" +
"def foo() {\n" +
" def i=21;\n" +
"def foo(body) {\n" +
" def i = body()\n" +
" semaphore 'watchA'\n" +
" return answer(i);\n" +
"}\n" +
Expand All @@ -44,7 +48,7 @@ public void persistenceOfLoadedScripts() throws Exception {
"node {\n" +
" println 'started'\n" +
" def o = load 'test.groovy'\n" +
" println 'o=' + o.foo();\n" +
" println 'o=' + o.foo({21})\n" +
"}"));

// get the build going
Expand Down

0 comments on commit 4266f0c

Please sign in to comment.