@@ -15,42 +15,42 @@ describe('TokenizeArgString', function () {
1515 it ( 'handles quoted string with no spaces' , function ( ) {
1616 var args = tokenizeArgString ( "--foo 'hello'" )
1717 args [ 0 ] . should . equal ( '--foo' )
18- args [ 1 ] . should . equal ( 'hello' )
18+ args [ 1 ] . should . equal ( " 'hello'" )
1919 } )
2020
2121 it ( 'handles single quoted string with spaces' , function ( ) {
2222 var args = tokenizeArgString ( "--foo 'hello world' --bar='foo bar'" )
2323 args [ 0 ] . should . equal ( '--foo' )
24- args [ 1 ] . should . equal ( 'hello world' )
25- args [ 2 ] . should . equal ( ' --bar=foo bar')
24+ args [ 1 ] . should . equal ( " 'hello world'" )
25+ args [ 2 ] . should . equal ( " --bar=' foo bar'" )
2626 } )
2727
2828 it ( 'handles double quoted string with spaces' , function ( ) {
2929 var args = tokenizeArgString ( '--foo "hello world" --bar="foo bar"' )
3030 args [ 0 ] . should . equal ( '--foo' )
31- args [ 1 ] . should . equal ( 'hello world' )
32- args [ 2 ] . should . equal ( '--bar=foo bar' )
31+ args [ 1 ] . should . equal ( '" hello world" ' )
32+ args [ 2 ] . should . equal ( '--bar=" foo bar" ' )
3333 } )
3434
3535 it ( 'handles single quoted empty string' , function ( ) {
3636 var args = tokenizeArgString ( '--foo \'\' --bar=\'\'' )
3737 args [ 0 ] . should . equal ( '--foo' )
38- args [ 1 ] . should . equal ( '' )
39- args [ 2 ] . should . equal ( ' --bar=')
38+ args [ 1 ] . should . equal ( "''" )
39+ args [ 2 ] . should . equal ( " --bar=''" )
4040 } )
4141
4242 it ( 'handles double quoted empty string' , function ( ) {
4343 var args = tokenizeArgString ( '--foo "" --bar=""' )
4444 args [ 0 ] . should . equal ( '--foo' )
45- args [ 1 ] . should . equal ( '' )
46- args [ 2 ] . should . equal ( '--bar=' )
45+ args [ 1 ] . should . equal ( '"" ' )
46+ args [ 2 ] . should . equal ( '--bar="" ' )
4747 } )
4848
4949 it ( 'handles quoted string with embeded quotes' , function ( ) {
5050 var args = tokenizeArgString ( '--foo "hello \'world\'" --bar=\'foo "bar"\'' )
5151 args [ 0 ] . should . equal ( '--foo' )
52- args [ 1 ] . should . equal ( 'hello \'world\'' )
53- args [ 2 ] . should . equal ( '--bar=foo "bar"' )
52+ args [ 1 ] . should . equal ( '" hello \'world\'" ' )
53+ args [ 2 ] . should . equal ( '--bar=\' foo "bar"\' ' )
5454 } )
5555
5656 // https://github.com/yargs/yargs-parser/pull/100
@@ -59,6 +59,6 @@ describe('TokenizeArgString', function () {
5959 var args = tokenizeArgString ( ' foo bar "foo bar" ' )
6060 args [ 0 ] . should . equal ( 'foo' )
6161 expect ( args [ 1 ] ) . equal ( 'bar' )
62- expect ( args [ 2 ] ) . equal ( 'foo bar' )
62+ expect ( args [ 2 ] ) . equal ( '" foo bar" ' )
6363 } )
6464} )
0 commit comments