@@ -1529,6 +1529,35 @@ describe('yargs-parser', function () {
15291529 var result = parser ( [ '-x' , 'val1' , '-x' , 'val1' ] )
15301530 result . should . have . property ( 'x' ) . that . is . an ( 'array' ) . and . to . deep . equal ( [ 'val1' , 'val1' ] )
15311531 } )
1532+
1533+ it ( 'should eat camelCase switch with camelCase array option' , function ( ) {
1534+ var result = parser ( [ '--someOption' , '1' , '2' ] , {
1535+ array : [ 'someOption' ]
1536+ } )
1537+ Array . isArray ( result . someOption ) . should . equal ( true )
1538+ result . someOption . should . deep . equal ( [ 1 , 2 ] )
1539+ } )
1540+ it ( 'should eat hyphenated switch with hyphenated array option' , function ( ) {
1541+ var result = parser ( [ '--some-option' , '1' , '2' ] , {
1542+ array : [ 'some-option' ]
1543+ } )
1544+ Array . isArray ( result [ 'some-option' ] ) . should . equal ( true )
1545+ result [ 'some-option' ] . should . deep . equal ( [ 1 , 2 ] )
1546+ } )
1547+ it ( 'should eat camelCase switch with hyphenated array option' , function ( ) {
1548+ var result = parser ( [ '--someOption' , '1' , '2' ] , {
1549+ array : [ 'some-option' ]
1550+ } )
1551+ Array . isArray ( result [ 'some-option' ] ) . should . equal ( true )
1552+ result [ 'some-option' ] . should . deep . equal ( [ 1 , 2 ] )
1553+ } )
1554+ it ( 'should eat hyphenated switch with camelCase array option' , function ( ) {
1555+ var result = parser ( [ '--some-option' , '1' , '2' ] , {
1556+ array : [ 'someOption' ]
1557+ } )
1558+ Array . isArray ( result [ 'someOption' ] ) . should . equal ( true )
1559+ result [ 'someOption' ] . should . deep . equal ( [ 1 , 2 ] )
1560+ } )
15321561 } )
15331562
15341563 describe ( 'nargs' , function ( ) {
0 commit comments