-
Notifications
You must be signed in to change notification settings - Fork 629
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
Add snake_case to params normalization #3884
Open
ahvigil
wants to merge
6
commits into
nextflow-io:master
Choose a base branch
from
ahvigil:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0ccb826
normalize ParamsMap keys to camelCase
ahvigil bca3393
Merge branch 'master' into master
ahvigil 43649da
allowNames should normalize to internal param representation
ahvigil 28d975e
Merge branch 'master' into master
ahvigil 2dfc86b
update cli docs
ahvigil 753ad9d
Merge branch 'master' into master
ahvigil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,29 +75,30 @@ class ScriptBindingTest extends Specification { | |
|
||
} | ||
|
||
def 'should convert hyphen separated string to camel case' () { | ||
def 'should normalize strings to camel case' () { | ||
|
||
expect: | ||
ScriptBinding.ParamsMap.hyphenToCamelCase('a') == 'a' | ||
ScriptBinding.ParamsMap.hyphenToCamelCase('A') == 'A' | ||
ScriptBinding.ParamsMap.hyphenToCamelCase('a-b-c-') == 'aBC' | ||
ScriptBinding.ParamsMap.hyphenToCamelCase('aa-bb-cc') == 'aaBbCc' | ||
ScriptBinding.ParamsMap.hyphenToCamelCase('alpha-beta-delta') == 'alphaBetaDelta' | ||
ScriptBinding.ParamsMap.hyphenToCamelCase('Alpha-Beta-delta') == 'AlphaBetaDelta' | ||
|
||
} | ||
|
||
def 'should convert camel case string to hyphen separated' () { | ||
|
||
expect: | ||
ScriptBinding.ParamsMap.camelCaseToHyphen('alphaBetaDelta') == 'alpha-beta-delta' | ||
ScriptBinding.ParamsMap.camelCaseToHyphen('AlphaBetaDelta') == 'Alpha-beta-delta' | ||
ScriptBinding.ParamsMap.camelCaseToHyphen('Field1') == 'Field1' | ||
ScriptBinding.ParamsMap.camelCaseToHyphen('FieldUno') == 'Field-uno' | ||
ScriptBinding.ParamsMap.camelCaseToHyphen('FieldUNO') == 'Field-UNO' | ||
ScriptBinding.ParamsMap.camelCaseToHyphen('FieldA') == 'Field-A' | ||
ScriptBinding.ParamsMap.camelCaseToHyphen('FieldAB') == 'Field-AB' | ||
ScriptBinding.ParamsMap.camelCaseToHyphen('FieldAb') == 'Field-ab' | ||
ScriptBinding.ParamsMap.normalizeToCamelCase('a') == 'a' | ||
ScriptBinding.ParamsMap.normalizeToCamelCase('A') == 'A' | ||
ScriptBinding.ParamsMap.normalizeToCamelCase('a-b-c-') == 'aBC' | ||
ScriptBinding.ParamsMap.normalizeToCamelCase('a_b_c-') == 'aBC' | ||
ScriptBinding.ParamsMap.normalizeToCamelCase('aa-bb-cc') == 'aaBbCc' | ||
ScriptBinding.ParamsMap.normalizeToCamelCase('aa_bb_cc') == 'aaBbCc' | ||
ScriptBinding.ParamsMap.normalizeToCamelCase('alpha_beta_delta') == 'alphaBetaDelta' | ||
ScriptBinding.ParamsMap.normalizeToCamelCase('alpha_beta-delta') == 'alphaBetaDelta' | ||
ScriptBinding.ParamsMap.normalizeToCamelCase('alpha-beta_delta') == 'alphaBetaDelta' | ||
ScriptBinding.ParamsMap.normalizeToCamelCase('alpha-beta-delta') == 'alphaBetaDelta' | ||
ScriptBinding.ParamsMap.normalizeToCamelCase('Alpha_beta_delta') == 'AlphaBetaDelta' | ||
ScriptBinding.ParamsMap.normalizeToCamelCase('Alpha_beta-delta') == 'AlphaBetaDelta' | ||
ScriptBinding.ParamsMap.normalizeToCamelCase('Alpha-beta_delta') == 'AlphaBetaDelta' | ||
ScriptBinding.ParamsMap.normalizeToCamelCase('Alpha-Beta-delta') == 'AlphaBetaDelta' | ||
ScriptBinding.ParamsMap.normalizeToCamelCase('Field1') == 'Field1' | ||
ScriptBinding.ParamsMap.normalizeToCamelCase('Field_uno') == 'FieldUno' | ||
ScriptBinding.ParamsMap.normalizeToCamelCase('Field_UNO') == 'FieldUNO' | ||
ScriptBinding.ParamsMap.normalizeToCamelCase('Field_A') == 'FieldA' | ||
ScriptBinding.ParamsMap.normalizeToCamelCase('field-ab') == 'fieldAb' | ||
ScriptBinding.ParamsMap.normalizeToCamelCase('Field_AB') == 'FieldAB' | ||
ScriptBinding.ParamsMap.normalizeToCamelCase('Field_ab') == 'FieldAb' | ||
|
||
} | ||
|
||
|
@@ -133,7 +134,7 @@ class ScriptBindingTest extends Specification { | |
|
||
then: | ||
map['field1'] == 1 | ||
map['field-1'] == null | ||
map['field-1'] == 1 | ||
map['field2'] == 2 | ||
map['Field2'] == 3 | ||
|
||
|
@@ -184,7 +185,7 @@ class ScriptBindingTest extends Specification { | |
when: | ||
def params = new ScriptBinding.ParamsMap('foo-bar':1) | ||
then: | ||
params.size() == 2 | ||
params.size() == 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
params.fooBar == 1 | ||
params.'foo-bar' == 1 | ||
params.all() == '--foo-bar 1' | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test case changes because camel case is a bit ambiguous with numbers-
field-1
normalizes tofield1
but field1 wasn't converting viacamelCaseToHyphen
intofield-1
.