Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Windows the dir separator must be '\\' and not '/' #224

Closed
joa-quim opened this issue Apr 10, 2019 · 7 comments
Closed

On Windows the dir separator must be '\\' and not '/' #224

joa-quim opened this issue Apr 10, 2019 · 7 comments

Comments

@joa-quim
Copy link

julia> @show get_summary(process_file("src/psconvert.jl"))
[ Info: Coverage.process_file: Detecting coverage for src/psconvert.jl
┌ Info: Coverage.process_cov: Coverage file(s) for src/psconvert.jl do not exist.
└ Assuming file has no coverage.
get_summary(process_file("src/psconvert.jl")) = (0, 37)
(0, 37)

julia> @show get_summary(process_file("src\\psconvert.jl"))
[ Info: Coverage.process_file: Detecting coverage for src\psconvert.jl
get_summary(process_file("src\\psconvert.jl")) = (26, 37)
(26, 37)
@fingolfin
Copy link
Member

It is unclear to me what the problem here is. What are you trying to do? What happens? What would you expect to happen instead?

Which versions of Julia and JuliaCoverage?

@joa-quim
Copy link
Author

Well, I thought it was clear. In my first command above that used "src/psconvert.jl" the (wrong) answer is Coverage file(s) for src/psconvert.jl do not exist.. Whilst the second, that uses "src\\psconvert.jl" correctly says

get_summary(process_file("src\\psconvert.jl")) = (26, 37)
julia> versioninfo()
Julia Version 1.1.0
Commit 80516ca202 (2019-01-21 21:24 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, haswell)
Environment:
  JULIA_PKGDIR = c:\j\.julia

Coverage v0.9.1

@joa-quim
Copy link
Author

One more thing. This came up because I was following the example in the README that says

# Or process a single file
@show get_summary(process_file("src/MyPkg.jl"))

So, maybe it's just a question of updating the README example (though the form with / should work too)

@ararslan
Copy link
Member

The general way to do this is joinpath, which automatically handles path separator differences across platforms. So the README (and any such internal uses) should simply be process_file(joinpath("src", "MyPkg.jl")).

@fingolfin
Copy link
Member

Well, I thought it was clear. In my first command above that used "src/psconvert.jl" the (wrong) answer is Coverage file(s) for src/psconvert.jl do not exist..

I don't see what is wrong about that answer, unless you happen to have a file with that name (including a slash in the name) around...

But of course the example in the README is indeed misleading! So I'll follow what @ararslan suggested.

@joa-quim
Copy link
Author

I don't see what is wrong about that answer,

What is wrong with that answer is simply that it is WRONG. The file does exist as is demonstrated by the answer to the command that uses "src\\psconvert.jl"

@fingolfin
Copy link
Member

It is only wrong if one assumes that slashes should silently be converted to backslashes on Windows. AFAIK, neither Julia nor Coverage.jl promise to do that. Thus, your assumptions were wrong, and you were using an invalid path. And so the output is exactly what I'd expect to see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants