-
Notifications
You must be signed in to change notification settings - Fork 621
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
manifest.contributors
config option
Signed-off-by: Ben Sherman <[email protected]>
- Loading branch information
1 parent
33fab52
commit c53cdc2
Showing
3 changed files
with
153 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
|
||
package nextflow.config | ||
|
||
import nextflow.exception.AbortOperationException | ||
import spock.lang.Specification | ||
/** | ||
* | ||
|
@@ -26,49 +27,108 @@ class ManifestTest extends Specification { | |
def 'should check manifest object' () { | ||
|
||
given: | ||
def MAN = [author: 'pablo', nextflowVersion: '1.2.3', name: 'foo', | ||
maintainer: 'john', organisation: 'My Organisation', icon: 'icon.png', | ||
docsUrl: 'https://docs.io', license: 'Apache v2'] | ||
def MAN = [ | ||
author: 'pablo', | ||
contributors: [ | ||
[ | ||
name: 'Alice', | ||
affiliation: 'University', | ||
email: '[email protected]', | ||
contribution: ['author', 'maintainer'], | ||
], | ||
[ | ||
name: 'Bob', | ||
affiliation: 'Company', | ||
email: '[email protected]', | ||
contribution: ['maintainer'], | ||
] | ||
], | ||
nextflowVersion: '1.2.3', | ||
name: 'foo', | ||
organisation: 'My Organisation', | ||
icon: 'icon.png', | ||
docsUrl: 'https://docs.io', | ||
license: 'Apache v2' | ||
] | ||
when: | ||
def manifest = new Manifest(MAN) | ||
then: | ||
manifest.with { | ||
author == 'pablo' | ||
nextflowVersion == '1.2.3' | ||
name == 'foo' | ||
maintainer == 'john' | ||
organisation == 'My Organisation' | ||
icon == 'icon.png' | ||
docsUrl == 'https://docs.io' | ||
license == 'Apache v2' | ||
} | ||
manifest.author == 'pablo' | ||
manifest.contributors == [ | ||
new Manifest.Contributor([ | ||
name: 'Alice', | ||
affiliation: 'University', | ||
email: '[email protected]', | ||
contribution: ['author', 'maintainer'], | ||
]), | ||
new Manifest.Contributor([ | ||
name: 'Bob', | ||
affiliation: 'Company', | ||
email: '[email protected]', | ||
contribution: ['maintainer'], | ||
]) | ||
] | ||
manifest.nextflowVersion == '1.2.3' | ||
manifest.name == 'foo' | ||
manifest.organisation == 'My Organisation' | ||
manifest.icon == 'icon.png' | ||
manifest.docsUrl == 'https://docs.io' | ||
manifest.license == 'Apache v2' | ||
|
||
} | ||
|
||
def 'should check empty manifest' () { | ||
|
||
// check empty manifest | ||
when: | ||
def manifest = new Manifest(new ConfigObject()) | ||
then: | ||
manifest.with { | ||
homePage == null | ||
defaultBranch == 'master' | ||
description == null | ||
author == null | ||
mainScript == 'main.nf' | ||
gitmodules == null | ||
nextflowVersion == null | ||
version == null | ||
name == null | ||
maintainer == null | ||
docsUrl == null | ||
organisation == null | ||
icon == null | ||
license == null | ||
} | ||
manifest.homePage == null | ||
manifest.defaultBranch == 'master' | ||
manifest.description == null | ||
manifest.author == null | ||
manifest.contributors == [] | ||
manifest.mainScript == 'main.nf' | ||
manifest.gitmodules == null | ||
manifest.nextflowVersion == null | ||
manifest.version == null | ||
manifest.name == null | ||
manifest.docsUrl == null | ||
manifest.organisation == null | ||
manifest.icon == null | ||
manifest.license == null | ||
|
||
} | ||
|
||
def 'should throw error on invalid manifest' () { | ||
when: | ||
def manifest = new Manifest([ | ||
contributors: [ 'Alice' ] | ||
]) | ||
manifest.contributors | ||
then: | ||
thrown(AbortOperationException) | ||
|
||
when: | ||
manifest = new Manifest([ | ||
contributors: [[ | ||
name: 'Alice', | ||
contribution: 'author' | ||
]] | ||
]) | ||
manifest.contributors | ||
then: | ||
thrown(AbortOperationException) | ||
|
||
when: | ||
manifest = new Manifest([ | ||
contributors: [[ | ||
name: 'Alice', | ||
contribution: [ 'owner' ] | ||
]] | ||
]) | ||
manifest.contributors | ||
then: | ||
thrown(AbortOperationException) | ||
} | ||
|
||
} |