Skip to content

Commit ccff356

Browse files
author
Alan Christie
committed
- Better handling of optional values
1 parent 053e166 commit ccff356

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/groovy/PipelineTester.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import org.apache.commons.cli.Option
3333

3434
// Version
3535
// Update with every change/release
36-
String version = '2.6.4'
36+
String version = '2.6.5'
3737

3838
println "+------------------+"
3939
println "| PipelineTester | v$version"

src/groovy/Tester.groovy

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,8 @@ class Tester {
483483
// Collect the optional minValues value
484484
if (option.minValues != null) {
485485
optionMinValues.add(option.minValues)
486+
} else {
487+
optionMinValues.add(0)
486488
}
487489

488490
// Collect the optional default value?
@@ -543,6 +545,7 @@ class Tester {
543545

544546
if (checkStatus) {
545547
// Now check that the user has not missed an option.
548+
int offset = 0
546549
optionNames.each { String option ->
547550
boolean foundParam = false
548551
params.each { param ->
@@ -562,11 +565,12 @@ class Tester {
562565
}
563566
}
564567
}
565-
if (!foundParam && optionMinValues.size() > 0 && optionMinValues[0] > 0) {
566-
Log.err("Pipeline option '$option' is not defined in the test's params" +
567-
" and there is no default value to use.")
568+
if (!foundParam && optionMinValues.size() > 0 && optionMinValues[offset] > 0) {
569+
Log.err("Pipeline option '$option' is not defined ($offset) in the test's params" +
570+
" and there is no default value to use. $optionMinValues")
568571
checkStatus = false
569572
}
573+
offset += 1
570574
}
571575
}
572576

0 commit comments

Comments
 (0)