File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import (
27
27
"strings"
28
28
"testing"
29
29
30
+ "github.com/google/shlex"
30
31
"github.com/rogpeppe/go-internal/goproxytest"
31
32
"github.com/rogpeppe/go-internal/gotooltest"
32
33
"github.com/rogpeppe/go-internal/testscript"
@@ -154,13 +155,10 @@ func TestX(t *testing.T) {
154
155
continue
155
156
}
156
157
157
- // TODO: Ugly hack to get args. Do more principled parsing.
158
- var args []string
159
- for _ , a := range strings .Split (cmd , " " )[1 :] {
160
- args = append (args , strings .Trim (a , "'" ))
161
- }
158
+ args , err := shlex .Split (cmd )
159
+ check (err )
162
160
163
- c , err := New (args )
161
+ c , err := New (args [ 1 :] )
164
162
check (err )
165
163
b := & bytes.Buffer {}
166
164
c .SetOutput (b )
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ require (
5
5
github.com/cockroachdb/apd/v2 v2.0.1
6
6
github.com/emicklei/proto v1.6.15
7
7
github.com/google/go-cmp v0.4.0
8
+ github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
8
9
github.com/google/uuid v1.2.0
9
10
github.com/kr/pretty v0.1.0
10
11
github.com/kylelemons/godebug v1.1.0
Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ
45
45
github.com/google/go-cmp v0.2.0 /go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M =
46
46
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4 =
47
47
github.com/google/go-cmp v0.4.0 /go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE =
48
+ github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4 =
49
+ github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 /go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ =
48
50
github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs =
49
51
github.com/google/uuid v1.2.0 /go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo =
50
52
github.com/gorilla/websocket v1.4.0 /go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ =
You can’t perform that action at this time.
0 commit comments