`add Test` fails in presence of `test` directory on macOS

The macOS file system is case insenitive but case preserving, so if you have a directory named test in your project (which is standard) and you try to add the Test module (which you need to do testing), you get the following error (1.4.0-rc1.0):

[ Info: Resolving package identifier `Test` as a directory at `/path/to/Project/Test`.
ERROR: Did not find a git repository at `Test`

That’s because the test directory is interpreted as a directory named Test, which then collides with the module name, and Julia blithely starts looking for the module there.

The workaround is to add the Test module before you create the test directory, which is not a problem – but perhaps one might wish to address this, somehow? E.g. somehow handle case issues on macOS or at least have a tailored error message specifically for Test where this collision is bound to occur for every project with a standard test setup on macOS, unless you do things in the right order?

And creating the directory first isn’t that unnatural. After all, if you try to run test in the package manager, you’re told the directory (with runtests.jl) is missing; then you add the directory and file, add using Test, and then you’re told you don’t have the module in your dependencies. Then you try to add it, and it fails…

Will be fixed by change REPL path resolution by 00vareladavid · Pull Request #1636 · JuliaLang/Pkg.jl · GitHub.