Skip to content

Commit 2c27fe5

Browse files
committed
test fixed
1 parent a51e91b commit 2c27fe5

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

stdlib/REPL/test/repl.jl

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,21 +1367,34 @@ fake_repl() do stdin_write, stdout_read, repl
13671367
repltask = @async begin
13681368
REPL.run_repl(repl)
13691369
end
1370+
# initialize `err` to `nothing`
1371+
write(stdin_write, "global err = nothing\n")
1372+
readline(stdout_read)
1373+
readline(stdout_read) == "\e[0m"
1374+
readuntil(stdout_read, "julia> ", keep=true)
1375+
# generate top-level error
13701376
write(stdin_write, "foobar\n")
13711377
readline(stdout_read)
13721378
@test readline(stdout_read) == "\e[0mERROR: UndefVarError: foobar not defined"
13731379
@test readline(stdout_read) == ""
13741380
readuntil(stdout_read, "julia> ", keep=true)
1381+
# check that top-level error did not change `err`
13751382
write(stdin_write, "err\n")
13761383
readline(stdout_read)
1377-
@test readline(stdout_read) == "\e[0mERROR: UndefVarError: err not defined"
1384+
@test readline(stdout_read) == "\e[0m"
13781385
readuntil(stdout_read, "julia> ", keep=true)
1386+
# generate deeper error
13791387
write(stdin_write, "foo() = foobar\n")
13801388
readline(stdout_read)
13811389
readuntil(stdout_read, "julia> ", keep=true)
13821390
write(stdin_write, "foo()\n")
13831391
readline(stdout_read)
1392+
@test readline(stdout_read) == "\e[0mERROR: UndefVarError: foobar not defined"
1393+
readuntil(stdout_read, "julia> ", keep=true)
1394+
# check that deeper error did set `err`
1395+
write(stdin_write, "err\n")
1396+
readline(stdout_read)
13841397
@test readline(stdout_read) == "\e[0m1-element ExceptionStack:"
1385-
@test readline(stdout_read) == "ERROR: UndefVarError: foobar not defined"
1398+
@test readline(stdout_read) == "UndefVarError: foobar not defined"
13861399
@test readline(stdout_read) == "Stacktrace:"
13871400
end

0 commit comments

Comments
 (0)