Skip to content

Commit

Permalink
test fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
BioTurboNick committed Jul 7, 2021
1 parent a51e91b commit 2c27fe5
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions stdlib/REPL/test/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1367,21 +1367,34 @@ fake_repl() do stdin_write, stdout_read, repl
repltask = @async begin
REPL.run_repl(repl)
end
# initialize `err` to `nothing`
write(stdin_write, "global err = nothing\n")
readline(stdout_read)
readline(stdout_read) == "\e[0m"
readuntil(stdout_read, "julia> ", keep=true)
# generate top-level error
write(stdin_write, "foobar\n")
readline(stdout_read)
@test readline(stdout_read) == "\e[0mERROR: UndefVarError: foobar not defined"
@test readline(stdout_read) == ""
readuntil(stdout_read, "julia> ", keep=true)
# check that top-level error did not change `err`
write(stdin_write, "err\n")
readline(stdout_read)
@test readline(stdout_read) == "\e[0mERROR: UndefVarError: err not defined"
@test readline(stdout_read) == "\e[0m"
readuntil(stdout_read, "julia> ", keep=true)
# generate deeper error
write(stdin_write, "foo() = foobar\n")
readline(stdout_read)
readuntil(stdout_read, "julia> ", keep=true)
write(stdin_write, "foo()\n")
readline(stdout_read)
@test readline(stdout_read) == "\e[0mERROR: UndefVarError: foobar not defined"
readuntil(stdout_read, "julia> ", keep=true)
# check that deeper error did set `err`
write(stdin_write, "err\n")
readline(stdout_read)
@test readline(stdout_read) == "\e[0m1-element ExceptionStack:"
@test readline(stdout_read) == "ERROR: UndefVarError: foobar not defined"
@test readline(stdout_read) == "UndefVarError: foobar not defined"
@test readline(stdout_read) == "Stacktrace:"
end

0 comments on commit 2c27fe5

Please sign in to comment.