-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added quoting tests for shell_split.
- Loading branch information
Showing
2 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# This file is a part of Julia. License is MIT: http://julialang.org/license | ||
|
||
# Ensure that quoting works | ||
@test Base.shell_split("foo bar baz") == ["foo", "bar", "baz"] | ||
@test Base.shell_split("foo\\ bar baz") == ["foo bar", "baz"] | ||
@test Base.shell_split("'foo bar' baz") == ["foo bar", "baz"] | ||
@test Base.shell_split("\"foo bar\" baz") == ["foo bar", "baz"] | ||
|
||
# "Over quoted" | ||
@test Base.shell_split("'foo\\ bar' baz") == ["foo\\ bar", "baz"] | ||
@test Base.shell_split("\"foo\\ bar\" baz") == ["foo\\ bar", "baz"] | ||
|
||
# Ensure that split works on ENV["EDITOR"] parsing as used by "edit". | ||
# See #13032. | ||
@test Base.shell_split("Sublime\\ Text/subl -w") == ["Sublime Text/subl", "-w"] | ||
@test Base.shell_split("'Sublime Text/subl' -w") == ["Sublime Text/subl", "-w"] | ||
@test Base.shell_split("\"Sublime Text/subl\" -w") == ["Sublime Text/subl", "-w"] | ||
|
||
# Backticks should automatically quote where necessary | ||
cmd = ["foo bar", "baz"] | ||
@test string(`$cmd`) == "`'foo bar' baz`" |