@@ -1493,23 +1493,31 @@ describe('yargs-parser', function () {
1493
1493
} )
1494
1494
1495
1495
describe ( '-' , function ( ) {
1496
- it ( 'should set - as value of n' , function ( ) {
1496
+ it ( 'should set - as space separated value of n' , function ( ) {
1497
1497
const argv = parser ( [ '-n' , '-' ] )
1498
1498
argv . should . have . property ( 'n' , '-' )
1499
1499
argv . should . have . property ( '_' ) . with . length ( 0 )
1500
1500
} )
1501
1501
1502
- it ( 'should set - as a non-hyphenated value' , function ( ) {
1502
+ it ( 'should set - as a non-hyphenated value (positional) ' , function ( ) {
1503
1503
const argv = parser ( [ '-' ] )
1504
1504
argv . should . have . property ( '_' ) . and . deep . equal ( [ '-' ] )
1505
1505
} )
1506
1506
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
1508
1509
const argv = parser ( [ '-f-' ] )
1509
1510
argv . should . have . property ( 'f' , '-' )
1510
1511
argv . should . have . property ( '_' ) . with . length ( 0 )
1511
1512
} )
1512
1513
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
+
1513
1521
it ( 'should set b to true and set - as a non-hyphenated value when b is set as a boolean' , function ( ) {
1514
1522
const argv = parser ( [ '-b' , '-' ] , {
1515
1523
boolean : [ 'b' ]
@@ -1527,6 +1535,18 @@ describe('yargs-parser', function () {
1527
1535
argv . should . have . property ( 's' , '-' )
1528
1536
argv . should . have . property ( '_' ) . with . length ( 0 )
1529
1537
} )
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
+ } )
1530
1550
} )
1531
1551
1532
1552
describe ( 'count' , function ( ) {
0 commit comments