@@ -1493,23 +1493,31 @@ describe('yargs-parser', function () {
14931493 } )
14941494
14951495 describe ( '-' , function ( ) {
1496- it ( 'should set - as value of n' , function ( ) {
1496+ it ( 'should set - as space separated value of n' , function ( ) {
14971497 const argv = parser ( [ '-n' , '-' ] )
14981498 argv . should . have . property ( 'n' , '-' )
14991499 argv . should . have . property ( '_' ) . with . length ( 0 )
15001500 } )
15011501
1502- it ( 'should set - as a non-hyphenated value' , function ( ) {
1502+ it ( 'should set - as a non-hyphenated value (positional) ' , function ( ) {
15031503 const argv = parser ( [ '-' ] )
15041504 argv . should . have . property ( '_' ) . and . deep . equal ( [ '-' ] )
15051505 } )
15061506
1507- it ( 'should set - as a value of f' , function ( ) {
1507+ it ( 'should set - as an embedded value of f' , function ( ) {
1508+ // special case dash trailing short option
15081509 const argv = parser ( [ '-f-' ] )
15091510 argv . should . have . property ( 'f' , '-' )
15101511 argv . should . have . property ( '_' ) . with . length ( 0 )
15111512 } )
15121513
1514+ it ( 'should set - as an embedded value of f with =' , function ( ) {
1515+ // usual style for embedded short option value
1516+ const argv = parser ( [ '-f=-' ] )
1517+ argv . should . have . property ( 'f' , '-' )
1518+ argv . should . have . property ( '_' ) . with . length ( 0 )
1519+ } )
1520+
15131521 it ( 'should set b to true and set - as a non-hyphenated value when b is set as a boolean' , function ( ) {
15141522 const argv = parser ( [ '-b' , '-' ] , {
15151523 boolean : [ 'b' ]
@@ -1527,6 +1535,18 @@ describe('yargs-parser', function () {
15271535 argv . should . have . property ( 's' , '-' )
15281536 argv . should . have . property ( '_' ) . with . length ( 0 )
15291537 } )
1538+
1539+ it ( 'should set - as space separated value of foo' , function ( ) {
1540+ const argv = parser ( [ '--foo' , '-' ] )
1541+ argv . should . have . property ( 'foo' , '-' )
1542+ argv . should . have . property ( '_' ) . with . length ( 0 )
1543+ } )
1544+
1545+ it ( 'should set - as embedded value of foo' , function ( ) {
1546+ const argv = parser ( [ '--foo=-' ] )
1547+ argv . should . have . property ( 'foo' , '-' )
1548+ argv . should . have . property ( '_' ) . with . length ( 0 )
1549+ } )
15301550 } )
15311551
15321552 describe ( 'count' , function ( ) {
0 commit comments