mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 05:22:22 +00:00
Added another variable 'index' that lets people create sparse matrix
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@14794 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
12e6a35672
commit
92d1759bcb
6 files changed
+84
-13
No files matched your search
@@ -9,18 +9,31 @@ import java.util.HashMap;
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class CombinationTest extends TestCase {
|
||||
AxisList axes = new AxisList(
|
||||
new Axis("a","X","x"),
|
||||
new Axis("b","Y","y"));
|
||||
|
||||
@SuppressWarnings({"RedundantStringConstructorCall"})
|
||||
public void testEval() {
|
||||
Map<String,String> r = new HashMap<String, String>();
|
||||
r.put("a","X");
|
||||
r.put("b",new String("Y")); // make sure this 'Y' is not the same object as literal "Y".
|
||||
Combination c = new Combination(r);
|
||||
assertTrue(c.evalGroovyExpression(null));
|
||||
assertTrue(c.evalGroovyExpression(" "));
|
||||
assertTrue(c.evalGroovyExpression("true"));
|
||||
assertTrue(c.evalGroovyExpression("a=='X'"));
|
||||
assertTrue(c.evalGroovyExpression("b=='Y'"));
|
||||
assertTrue(c.evalGroovyExpression("(a=='something').implies(b=='other')"));
|
||||
|
||||
r.put("a","x");
|
||||
Combination d = new Combination(r);
|
||||
|
||||
assertTrue(eval(c, null));
|
||||
assertTrue(eval(c," "));
|
||||
assertTrue(eval(c,"true"));
|
||||
assertTrue(eval(c,"a=='X'"));
|
||||
assertTrue(eval(c,"b=='Y'"));
|
||||
assertTrue(eval(c,"(a=='something').implies(b=='other')"));
|
||||
assertTrue(eval(c,"index%2==0")^eval(d,"index%2==0"));
|
||||
assertTrue(eval(c,"index%2==1")^eval(d,"index%2==1"));
|
||||
}
|
||||
|
||||
private boolean eval(Combination c, String exp) {
|
||||
return c.evalGroovyExpression(axes, exp);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user