@@ -1487,23 +1487,31 @@ describe('yargs-parser', function () {
14871487 } )
14881488
14891489 describe ( '-' , function ( ) {
1490- it ( 'should set - as value of n' , function ( ) {
1490+ it ( 'should set - as space separated value of n' , function ( ) {
14911491 const argv = parser ( [ '-n' , '-' ] )
14921492 argv . should . have . property ( 'n' , '-' )
14931493 argv . should . have . property ( '_' ) . with . length ( 0 )
14941494 } )
14951495
1496- it ( 'should set - as a non-hyphenated value' , function ( ) {
1496+ it ( 'should set - as a non-hyphenated value (positional) ' , function ( ) {
14971497 const argv = parser ( [ '-' ] )
14981498 argv . should . have . property ( '_' ) . and . deep . equal ( [ '-' ] )
14991499 } )
15001500
1501- it ( 'should set - as a value of f' , function ( ) {
1501+ it ( 'should set - as an embedded value of f' , function ( ) {
1502+ // special case dash trailing short option
15021503 const argv = parser ( [ '-f-' ] )
15031504 argv . should . have . property ( 'f' , '-' )
15041505 argv . should . have . property ( '_' ) . with . length ( 0 )
15051506 } )
15061507
1508+ it ( 'should set - as an embedded value of f with =' , function ( ) {
1509+ // usual style for embedded short option value
1510+ const argv = parser ( [ '-f=-' ] )
1511+ argv . should . have . property ( 'f' , '-' )
1512+ argv . should . have . property ( '_' ) . with . length ( 0 )
1513+ } )
1514+
15071515 it ( 'should set b to true and set - as a non-hyphenated value when b is set as a boolean' , function ( ) {
15081516 const argv = parser ( [ '-b' , '-' ] , {
15091517 boolean : [ 'b' ]
@@ -1521,6 +1529,18 @@ describe('yargs-parser', function () {
15211529 argv . should . have . property ( 's' , '-' )
15221530 argv . should . have . property ( '_' ) . with . length ( 0 )
15231531 } )
1532+
1533+ it ( 'should set - as space separated value of foo' , function ( ) {
1534+ const argv = parser ( [ '--foo' , '-' ] )
1535+ argv . should . have . property ( 'foo' , '-' )
1536+ argv . should . have . property ( '_' ) . with . length ( 0 )
1537+ } )
1538+
1539+ it ( 'should set - as embedded value of foo' , function ( ) {
1540+ const argv = parser ( [ '--foo=-' ] )
1541+ argv . should . have . property ( 'foo' , '-' )
1542+ argv . should . have . property ( '_' ) . with . length ( 0 )
1543+ } )
15241544 } )
15251545
15261546 describe ( 'count' , function ( ) {
0 commit comments