Skip to content

Commit 48b064d

Browse files
committed
Moved tests into existing files.
1 parent e0b871e commit 48b064d

File tree

5 files changed

+65
-62
lines changed

5 files changed

+65
-62
lines changed

test/choosetests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function choosetests(choices = [])
3232
"nullable", "meta", "profile", "libgit2", "docs", "markdown",
3333
"base64", "serialize", "functors", "misc",
3434
"enums", "cmdlineargs", "i18n", "workspace", "libdl", "int",
35-
"intset", "floatfuncs", "compile", "shell", "interactiveutil"
35+
"intset", "floatfuncs", "compile"
3636
]
3737

3838
if Base.USE_GPL_LIBS

test/interactiveutil.jl

Lines changed: 0 additions & 40 deletions
This file was deleted.

test/replutil.jl

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,45 @@ let
132132
showerror(buff, MethodError(convert, Tuple{Type, Float64}))
133133
showerror(buff, MethodError(convert, Tuple{DataType, Float64}))
134134
end
135+
136+
# Issue #13032
137+
let
138+
# Make sure editor doesn't error when no ENV editor is set.
139+
pop!(ENV, "JULIA_EDITOR", "")
140+
pop!(ENV, "VISUAL", "")
141+
pop!(ENV, "EDITOR", "")
142+
@test isa(Base.editor(), Array)
143+
144+
# Invalid editors
145+
ENV["JULIA_EDITOR"] = ""
146+
@test_throws ErrorException Base.editor()
147+
148+
# Note: The following testcases should work regardless of whether these editors are
149+
# installed or not.
150+
151+
# Editor on the path.
152+
ENV["JULIA_EDITOR"] = "vim"
153+
@test Base.editor() == ["vim"]
154+
155+
# Absolute path to editor.
156+
ENV["JULIA_EDITOR"] = "/usr/bin/vim"
157+
@test Base.editor() == ["/usr/bin/vim"]
158+
159+
# Editor on the path using arguments.
160+
ENV["JULIA_EDITOR"] = "subl -w"
161+
@test Base.editor() == ["subl", "-w"]
162+
163+
# Absolute path to editor with spaces.
164+
ENV["JULIA_EDITOR"] = "/Applications/Sublime\\ Text.app/Contents/SharedSupport/bin/subl"
165+
@test Base.editor() == ["/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"]
166+
167+
# Paths with spaces and arguments (#13032).
168+
ENV["JULIA_EDITOR"] = "/Applications/Sublime\\ Text.app/Contents/SharedSupport/bin/subl -w"
169+
@test Base.editor() == ["/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl", "-w"]
170+
171+
ENV["JULIA_EDITOR"] = "'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl' -w"
172+
@test Base.editor() == ["/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl", "-w"]
173+
174+
ENV["JULIA_EDITOR"] = "\"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl\" -w"
175+
@test Base.editor() == ["/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl", "-w"]
176+
end

test/shell.jl

Lines changed: 0 additions & 21 deletions
This file was deleted.

test/spawn.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,3 +271,25 @@ let fname = tempname()
271271
@test success(pipeline(`cat $fname`, `$exename -e $code`))
272272
rm(fname)
273273
end
274+
275+
let cmd = AbstractString[]
276+
# Ensure that quoting works
277+
@test Base.shell_split("foo bar baz") == ["foo", "bar", "baz"]
278+
@test Base.shell_split("foo\\ bar baz") == ["foo bar", "baz"]
279+
@test Base.shell_split("'foo bar' baz") == ["foo bar", "baz"]
280+
@test Base.shell_split("\"foo bar\" baz") == ["foo bar", "baz"]
281+
282+
# "Over quoted"
283+
@test Base.shell_split("'foo\\ bar' baz") == ["foo\\ bar", "baz"]
284+
@test Base.shell_split("\"foo\\ bar\" baz") == ["foo\\ bar", "baz"]
285+
286+
# Ensure that shell_split handles quoted spaces
287+
cmd = ["/Volumes/External HD/program", "-a"]
288+
@test Base.shell_split("/Volumes/External\\ HD/program -a") == cmd
289+
@test Base.shell_split("'/Volumes/External HD/program' -a") == cmd
290+
@test Base.shell_split("\"/Volumes/External HD/program\" -a") == cmd
291+
292+
# Backticks should automatically quote where necessary
293+
cmd = ["foo bar", "baz"]
294+
@test string(`$cmd`) == "`'foo bar' baz`"
295+
end

0 commit comments

Comments
 (0)