File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -144,11 +144,17 @@ loop:
144
144
}
145
145
case '"' :
146
146
if ! singleQuoted && ! dollarQuote {
147
+ if doubleQuoted && buf == "" {
148
+ got = true
149
+ }
147
150
doubleQuoted = ! doubleQuoted
148
151
continue
149
152
}
150
153
case '\'' :
151
154
if ! doubleQuoted && ! dollarQuote {
155
+ if singleQuoted && buf == "" {
156
+ got = true
157
+ }
152
158
singleQuoted = ! singleQuoted
153
159
continue
154
160
}
Original file line number Diff line number Diff line change @@ -69,6 +69,28 @@ func TestLastSpace(t *testing.T) {
69
69
}
70
70
}
71
71
72
+ func TestEmptyArgs (t * testing.T ) {
73
+ args , err := Parse (`foo "" bar ''` )
74
+ if err != nil {
75
+ t .Fatal (err )
76
+ }
77
+ if len (args ) != 4 {
78
+ t .Fatal ("Should have three elements" )
79
+ }
80
+ if args [0 ] != "foo" {
81
+ t .Fatal ("1st element should be `foo`" )
82
+ }
83
+ if args [1 ] != "" {
84
+ t .Fatal ("2nd element should be empty" )
85
+ }
86
+ if args [2 ] != "bar" {
87
+ t .Fatal ("3rd element should be `bar`" )
88
+ }
89
+ if args [3 ] != "" {
90
+ t .Fatal ("4th element should be empty" )
91
+ }
92
+ }
93
+
72
94
func TestShellRun (t * testing.T ) {
73
95
dir , err := os .Getwd ()
74
96
if err != nil {
You can’t perform that action at this time.
0 commit comments