Skip to content

Commit

Permalink
Moved tests into existing files.
Browse files Browse the repository at this point in the history
  • Loading branch information
omus committed Sep 16, 2015
1 parent e0b871e commit 48b064d
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 62 deletions.
2 changes: 1 addition & 1 deletion test/choosetests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function choosetests(choices = [])
"nullable", "meta", "profile", "libgit2", "docs", "markdown",
"base64", "serialize", "functors", "misc",
"enums", "cmdlineargs", "i18n", "workspace", "libdl", "int",
"intset", "floatfuncs", "compile", "shell", "interactiveutil"
"intset", "floatfuncs", "compile"
]

if Base.USE_GPL_LIBS
Expand Down
40 changes: 0 additions & 40 deletions test/interactiveutil.jl

This file was deleted.

42 changes: 42 additions & 0 deletions test/replutil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,45 @@ let
showerror(buff, MethodError(convert, Tuple{Type, Float64}))
showerror(buff, MethodError(convert, Tuple{DataType, Float64}))
end

# Issue #13032
let
# Make sure editor doesn't error when no ENV editor is set.
pop!(ENV, "JULIA_EDITOR", "")
pop!(ENV, "VISUAL", "")
pop!(ENV, "EDITOR", "")
@test isa(Base.editor(), Array)

# Invalid editors
ENV["JULIA_EDITOR"] = ""
@test_throws ErrorException Base.editor()

# Note: The following testcases should work regardless of whether these editors are
# installed or not.

# Editor on the path.
ENV["JULIA_EDITOR"] = "vim"
@test Base.editor() == ["vim"]

# Absolute path to editor.
ENV["JULIA_EDITOR"] = "/usr/bin/vim"
@test Base.editor() == ["/usr/bin/vim"]

# Editor on the path using arguments.
ENV["JULIA_EDITOR"] = "subl -w"
@test Base.editor() == ["subl", "-w"]

# Absolute path to editor with spaces.
ENV["JULIA_EDITOR"] = "/Applications/Sublime\\ Text.app/Contents/SharedSupport/bin/subl"
@test Base.editor() == ["/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"]

# Paths with spaces and arguments (#13032).
ENV["JULIA_EDITOR"] = "/Applications/Sublime\\ Text.app/Contents/SharedSupport/bin/subl -w"
@test Base.editor() == ["/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl", "-w"]

ENV["JULIA_EDITOR"] = "'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl' -w"
@test Base.editor() == ["/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl", "-w"]

ENV["JULIA_EDITOR"] = "\"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl\" -w"
@test Base.editor() == ["/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl", "-w"]
end
21 changes: 0 additions & 21 deletions test/shell.jl

This file was deleted.

22 changes: 22 additions & 0 deletions test/spawn.jl
Original file line number Diff line number Diff line change
Expand Up @@ -271,3 +271,25 @@ let fname = tempname()
@test success(pipeline(`cat $fname`, `$exename -e $code`))
rm(fname)
end

let cmd = AbstractString[]
# 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 shell_split handles quoted spaces
cmd = ["/Volumes/External HD/program", "-a"]
@test Base.shell_split("/Volumes/External\\ HD/program -a") == cmd
@test Base.shell_split("'/Volumes/External HD/program' -a") == cmd
@test Base.shell_split("\"/Volumes/External HD/program\" -a") == cmd

# Backticks should automatically quote where necessary
cmd = ["foo bar", "baz"]
@test string(`$cmd`) == "`'foo bar' baz`"
end

0 comments on commit 48b064d

Please sign in to comment.