Skip to content

Commit 4d8cc59

Browse files
expand tests
1 parent 8f452d6 commit 4d8cc59

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

test/cmdlineargs.jl

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,10 +473,47 @@ let exename = `$(Base.julia_cmd()) --startup-file=no --color=no`
473473
@test occursin(expected, got) || (expected, got)
474474
@test_broken occursin(expected_good, got)
475475

476+
# Ask for coverage in current directory
477+
tdir = dirname(realpath(inputfile))
478+
cd(tdir) do
479+
# there may be atrailing separator here so use rstrip
480+
@test readchomp(`$exename -E "(Base.JLOptions().code_coverage, rstrip(unsafe_string(Base.JLOptions().tracked_path), '/'))" -L $inputfile
481+
--code-coverage=$covfile --code-coverage=@`) == "(3, $(repr(tdir)))"
482+
end
483+
@test isfile(covfile)
484+
got = read(covfile, String)
485+
rm(covfile)
486+
@test occursin(expected, got) || (expected, got)
487+
@test_broken occursin(expected_good, got)
488+
489+
# Ask for coverage in relative directory
490+
tdir = dirname(realpath(inputfile))
491+
cd(dirname(tdir)) do
492+
@test readchomp(`$exename -E "(Base.JLOptions().code_coverage, unsafe_string(Base.JLOptions().tracked_path))" -L $inputfile
493+
--code-coverage=$covfile --code-coverage=@testhelpers`) == "(3, $(repr(tdir)))"
494+
end
495+
@test isfile(covfile)
496+
got = read(covfile, String)
497+
rm(covfile)
498+
@test occursin(expected, got) || (expected, got)
499+
@test_broken occursin(expected_good, got)
500+
501+
# Ask for coverage in relative directory with dot-dot notation
502+
tdir = dirname(realpath(inputfile))
503+
cd(tdir) do
504+
@test readchomp(`$exename -E "(Base.JLOptions().code_coverage, unsafe_string(Base.JLOptions().tracked_path))" -L $inputfile
505+
--code-coverage=$covfile --code-coverage=@../testhelpers`) == "(3, $(repr(tdir)))"
506+
end
507+
@test isfile(covfile)
508+
got = read(covfile, String)
509+
rm(covfile)
510+
@test occursin(expected, got) || (expected, got)
511+
@test_broken occursin(expected_good, got)
512+
476513
# Ask for coverage in a different directory
477514
tdir = mktempdir() # a dir that contains no code
478515
@test readchomp(`$exename -E "(Base.JLOptions().code_coverage, unsafe_string(Base.JLOptions().tracked_path))" -L $inputfile
479-
--code-coverage=$covfile --code-coverage=@$tdir`) == "(3, $(repr(tdir)))"
516+
--code-coverage=$covfile --code-coverage=@$tdir`) == "(3, $(repr(realpath(tdir))))"
480517
@test isfile(covfile)
481518
got = read(covfile, String)
482519
@test isempty(got)

0 commit comments

Comments
 (0)