Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix env output with quotes #5597

Open
wants to merge 1 commit into
base: STABLE-23.10.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ class EnvOutParam extends BaseOutParam implements OptionalParam {
if( obj instanceof TokenVar ) {
this.nameObj = obj.name
}
else if( obj instanceof CharSequence ) {
this.nameObj = obj.toString()
}
else {
throw new IllegalArgumentException("Unexpected environment output definition - it should be either a string or a variable identifier - offending value: ${obj?.getClass()?.getName()}")
}

return this
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,31 @@ class EnvOutParamTest extends Dsl2Spec {

}

def 'should define env outputs with quotes' () {
setup:
def text = '''
process hola {
output:
env 'FOO'
env 'BAR'

/echo command/
}

workflow { hola() }
'''
def binding = [:]
def process = parseAndReturnProcess(text, binding)
when:
def outs = process.config.getOutputs() as List<EnvOutParam>
then:
outs.size() == 2
and:
outs[0].name == 'FOO'
and:
outs[1].name == 'BAR'
}

def 'should define optional env outputs' () {
setup:
def text = '''
Expand Down
Loading