@@ -127,6 +127,32 @@ describe('yargs-parser', function () {
127127 argv . _ [ 0 ] . should . be . a ( 'number' )
128128 } )
129129
130+ // addresses: https://github.com/yargs/yargs-parser/issues/33
131+ it ( 'should handle parsing negative #s' , function ( ) {
132+ var argv = parser ( [
133+ '-33' , '-177' , '33' ,
134+ '--n1' , '-33' ,
135+ '-n' , '-44' ,
136+ '--n2=-55' ,
137+ '--foo.bar' , '-33' ,
138+ '-o=-55' ,
139+ '--bounds' , '-180' , '99' , '-180' , '90' ,
140+ '--other' , '-99' , '-220'
141+ ] , {
142+ array : 'bounds' ,
143+ narg : { 'other' : 2 }
144+ } )
145+
146+ argv . _ . should . deep . equal ( [ - 33 , - 177 , 33 ] )
147+ argv . n1 . should . equal ( - 33 )
148+ argv . n . should . equal ( - 44 )
149+ argv . n2 . should . equal ( - 55 )
150+ argv . foo . bar . should . equal ( - 33 )
151+ argv . o . should . equal ( - 55 )
152+ argv . bounds . should . deep . equal ( [ - 180 , 99 , - 180 , 90 ] )
153+ argv . other . should . deep . equal ( [ - 99 , - 220 ] )
154+ } )
155+
130156 it ( 'should set the value of a single short option to the next supplied value, even if the value is empty' , function ( ) {
131157 var parse = parser ( [ '-p' , '' ] )
132158 parse . should . have . property ( 'p' , '' )
@@ -901,13 +927,6 @@ describe('yargs-parser', function () {
901927 argv . should . have . property ( 'n' , 123 )
902928 argv . should . have . property ( '_' ) . with . length ( 0 )
903929 } )
904-
905- it ( 'should set option "1" to true, option "2" to true, and option "3" to numeric value 456' , function ( ) {
906- var argv = parser ( [ '-123' , '456' ] )
907- argv . should . have . property ( '1' , true )
908- argv . should . have . property ( '2' , true )
909- argv . should . have . property ( '3' , 456 )
910- } )
911930 } )
912931
913932 describe ( 'whitespace' , function ( ) {
0 commit comments