nf-test
nf-test copied to clipboard
Behaviour of `with` block
I couldn't quite figure it out, but I see some surprising behaviour using the with
block. As an example, the following code works
def items = process.out.report
assert items.size() == 2 : 'The number of output reports does not correspond to the number of inputs.'
assert items.collect { meta, report -> file(model).name == "${meta.id}.txt" }.inject(true) { a, b -> a && b } : 'The reports are named unexpectedly.'
but the following code fails with a groovy.lang.MissingMethodException
with(process.out.report) {
assert size() == 2 : 'The number of output reports does not correspond to the number of inputs.'
assert collect { meta, report -> file(model).name == "${meta.id}.txt" }.inject(true) { a, b -> a && b } : 'The reports are named unexpectedly.'
}
so it seems that method dispatch works differently somehow?