Skip to content

Commit

Permalink
Add tests [ci fast]
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
  • Loading branch information
pditommaso committed Nov 1, 2023
1 parent c73a7aa commit 358224f
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,6 @@ interface OutParam extends Cloneable {

String getChannelEmitName()

String getChannelTopicName()

}
Original file line number Diff line number Diff line change
Expand Up @@ -1197,4 +1197,84 @@ class ParamsOutTest extends Dsl2Spec {
outs[2].inner[1].name == 'bar'

}


def 'should define out with topic' () {
setup:
def text = '''
process hola {
output:
val x, topic: ch0
env FOO, topic: ch1
path '-', topic: ch2
stdout topic: ch3
/return/
}
workflow { hola() }
'''

def binding = [:]
def process = parseAndReturnProcess(text, binding)

when:
def outs = process.config.getOutputs() as List<OutParam>
then:
outs[0].name == 'x'
outs[0].channelTopicName == 'ch0'
and:
outs[1].name == 'FOO'
outs[1].channelTopicName == 'ch1'
and:
outs[2] instanceof StdOutParam // <-- note: declared as `path`, turned into a `stdout`
outs[2].name == '-'
outs[2].channelTopicName == 'ch2'
and:
outs[3] instanceof StdOutParam
outs[3].name == '-'
outs[3].channelTopicName == 'ch3'
}

def 'should define out tuple with topic'() {

setup:
def text = '''
process hola {
output:
tuple val(x), val(y), topic: ch1
tuple path('foo'), topic: ch2
tuple stdout,env(bar), topic: ch3
/return/
}
workflow { hola() }
'''

def binding = [:]
def process = parseAndReturnProcess(text, binding)

when:
def outs = process.config.getOutputs() as List<TupleOutParam>

then:
outs[0].name == 'tupleoutparam<0>'
outs[0].channelTopicName == 'ch1'
outs[0].inner[0] instanceof ValueOutParam
outs[0].inner[0].name == 'x'
outs[0].inner[1] instanceof ValueOutParam
outs[0].inner[1].name == 'y'
and:
outs[1].name == 'tupleoutparam<1>'
outs[1].channelTopicName == 'ch2'
outs[1].inner[0] instanceof FileOutParam
and:
outs[2].name == 'tupleoutparam<2>'
outs[2].channelTopicName == 'ch3'
outs[2].inner[0] instanceof StdOutParam
outs[2].inner[0].name == '-'
outs[2].inner[1] instanceof EnvOutParam
outs[2].inner[1].name == 'bar'

}
}

0 comments on commit 358224f

Please sign in to comment.