Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #143 from abayer/jenkins-38268
[JENKINS-38268] Testing for lexical closure scope
  • Loading branch information
jglick committed Jun 13, 2017
2 parents d897ac0 + b6038c4 commit 874ae47
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -174,7 +174,7 @@
<dependency>
<groupId>com.cloudbees</groupId>
<artifactId>groovy-cps</artifactId>
<version>1.14</version>
<version>1.15</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.ui</groupId>
Expand Down
Expand Up @@ -466,4 +466,25 @@ public void invisibleParallelBranch() throws Exception {
});
}

@Issue("JENKINS-38268")
@Test
public void parallelLexicalScope() throws Exception {
story.addStep(new Statement() {
@Override public void evaluate() throws Throwable {
p = jenkins().createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition("def fn = { arg ->\n" +
" arg.count = arg.count + 1;\n" +
"}\n" +
"def a = [ id: 'a', count : 0 ];\n" +
"def b = [ id: 'b', count : 0 ];\n" +
"parallel(\n" +
" StepA : { fn(a); },\n" +
" StepB : { fn(b); },\n" +
");\n" +
"assert a.count == 1;\n" +
"assert b.count == 1;\n", true));
story.j.buildAndAssertSuccess(p);
}
});
}
}

0 comments on commit 874ae47

Please sign in to comment.