Skip to content

Commit 249eb1a

Browse files
pditommasoclaudebentsherman
authored
Add unit test for invalid workflow entry name error handling (#6409)
Signed-off-by: Paolo Di Tommaso <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: Ben Sherman <[email protected]>
1 parent c3959cf commit 249eb1a

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

modules/nextflow/src/main/groovy/nextflow/script/ScriptMeta.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ class ScriptMeta {
256256
final result = new HashSet(definitions.size() + imports.size())
257257
// local definitions
258258
for( def item : definitions.values() ) {
259-
if( item instanceof WorkflowDef && item.name != null )
259+
if( item instanceof WorkflowDef && item.name )
260260
result.add(item.name)
261261
}
262262
// processes from imports

modules/nextflow/src/test/groovy/nextflow/script/ScriptDslTest.groovy

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,4 +626,22 @@ class ScriptDslTest extends Dsl2Spec {
626626
e2.message == 'Missing process or function Channel.doesNotExist()'
627627
}
628628

629+
def 'should show proper error message for invalid entry name' () {
630+
when:
631+
// Use dsl_eval with an invalid entry name to trigger the error
632+
dsl_eval('invalidEntry', '''
633+
workflow validWorkflow {
634+
/println 'valid'/
635+
}
636+
637+
workflow {
638+
/println 'default'/
639+
}
640+
''')
641+
642+
then:
643+
def err = thrown(IllegalArgumentException)
644+
err.message.contains('Unknown workflow entry name: invalidEntry')
645+
}
646+
629647
}

0 commit comments

Comments
 (0)