mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[xcodegen] Stop at shell operator in parseKnownCommandOnly
We're dealing with a potentially arbitary shell command here, so make sure we don't continue parsing after a shell operator such as `&&`.
This commit is contained in:
@@ -54,6 +54,31 @@ class CompileCommandsTests: XCTestCase {
|
||||
knownCommandOnly: true
|
||||
)
|
||||
|
||||
for op in ["&&", "||", ">", "<", ">>", ";", "(", ")"] {
|
||||
assertParse(
|
||||
"x y x/y/clang -DX -I \(op) ignored",
|
||||
executable: "x/y/clang",
|
||||
args: [.option(.D, spacing: .unspaced, value: "X"), .flag(.I)],
|
||||
knownCommandOnly: true
|
||||
)
|
||||
assertParse(
|
||||
"x y x/y/clang -DX -I x\(op) ignored",
|
||||
executable: "x/y/clang",
|
||||
args: [
|
||||
.option(.D, spacing: .unspaced, value: "X"),
|
||||
.option(.I, spacing: .spaced, value: "x")
|
||||
],
|
||||
knownCommandOnly: true
|
||||
)
|
||||
}
|
||||
|
||||
assertParse(
|
||||
#"x/y/clang \< x\< "<""#,
|
||||
executable: "x/y/clang",
|
||||
args: [.value("<"), .value("x<"), .value("<")],
|
||||
knownCommandOnly: true
|
||||
)
|
||||
|
||||
assertParse(
|
||||
"clang -DX -I",
|
||||
args: [.option(.D, spacing: .unspaced, value: "X"), .flag(.I)]
|
||||
|
||||
Reference in New Issue
Block a user