From 4e6b4a601ba759a5d903138dcd1e61b72adc5e2c Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Thu, 10 Jun 2021 17:04:36 -0400 Subject: [PATCH] test fixed --- stdlib/REPL/test/repl.jl | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/stdlib/REPL/test/repl.jl b/stdlib/REPL/test/repl.jl index a828432f5a614b..9b4ffbf59783ae 100644 --- a/stdlib/REPL/test/repl.jl +++ b/stdlib/REPL/test/repl.jl @@ -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