@@ -1487,23 +1487,31 @@ describe('yargs-parser', function () {
1487
1487
} )
1488
1488
1489
1489
describe ( '-' , function ( ) {
1490
- it ( 'should set - as value of n' , function ( ) {
1490
+ it ( 'should set - as space separated value of n' , function ( ) {
1491
1491
const argv = parser ( [ '-n' , '-' ] )
1492
1492
argv . should . have . property ( 'n' , '-' )
1493
1493
argv . should . have . property ( '_' ) . with . length ( 0 )
1494
1494
} )
1495
1495
1496
- it ( 'should set - as a non-hyphenated value' , function ( ) {
1496
+ it ( 'should set - as a non-hyphenated value (positional) ' , function ( ) {
1497
1497
const argv = parser ( [ '-' ] )
1498
1498
argv . should . have . property ( '_' ) . and . deep . equal ( [ '-' ] )
1499
1499
} )
1500
1500
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
1502
1503
const argv = parser ( [ '-f-' ] )
1503
1504
argv . should . have . property ( 'f' , '-' )
1504
1505
argv . should . have . property ( '_' ) . with . length ( 0 )
1505
1506
} )
1506
1507
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
+
1507
1515
it ( 'should set b to true and set - as a non-hyphenated value when b is set as a boolean' , function ( ) {
1508
1516
const argv = parser ( [ '-b' , '-' ] , {
1509
1517
boolean : [ 'b' ]
@@ -1521,6 +1529,18 @@ describe('yargs-parser', function () {
1521
1529
argv . should . have . property ( 's' , '-' )
1522
1530
argv . should . have . property ( '_' ) . with . length ( 0 )
1523
1531
} )
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
+ } )
1524
1544
} )
1525
1545
1526
1546
describe ( 'count' , function ( ) {
0 commit comments