xtool/safesplit:properly handle consecutive short flags
This commit is contained in:
@@ -50,8 +50,8 @@ func TestSplitPkgConfigFlags(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("consecutive_flags", func(t *testing.T) {
|
||||
ftest("-I -L", `["-I-L"]`)
|
||||
ftest("-I -L /usr/lib", `["-I-L /usr/lib"]`)
|
||||
ftest("-I -L", `["-I" "-L"]`)
|
||||
ftest("-I -L /usr/lib", `["-I" "-L/usr/lib"]`)
|
||||
})
|
||||
|
||||
t.Run("edge_cases", func(t *testing.T) {
|
||||
@@ -59,7 +59,7 @@ func TestSplitPkgConfigFlags(t *testing.T) {
|
||||
ftest(" ", "[]")
|
||||
ftest("-", `["-"]`)
|
||||
ftest("-I", `["-I"]`)
|
||||
ftest("-I -", `["-I-"]`)
|
||||
ftest("-I -", `["-I" "-"]`)
|
||||
})
|
||||
|
||||
t.Run("escaped_spaces", func(t *testing.T) {
|
||||
@@ -77,6 +77,12 @@ func TestSplitPkgConfigFlags(t *testing.T) {
|
||||
ftest("-DVERSION=2.1 -DDEBUG=1", `["-DVERSION=2.1" "-DDEBUG=1"]`)
|
||||
ftest("-D VERSION=2.1 -D DEBUG=1", `["-DVERSION=2.1" "-DDEBUG=1"]`)
|
||||
})
|
||||
|
||||
// case for https://github.com/goplus/llgo/issues/1244
|
||||
t.Run("w_pipe", func(t *testing.T) {
|
||||
ftest("-w -pipe", `["-w" "-pipe"]`)
|
||||
ftest("-Os -w -pipe", `["-Os" "-w" "-pipe"]`)
|
||||
})
|
||||
}
|
||||
|
||||
func toString(ss []string) string {
|
||||
|
||||
Reference in New Issue
Block a user