relative_path broken on windows
pwd = Pathname.new("C:/Development/src/ruby_trunk/test/minitest")
basedir = Pathname.new("c:/Development/ruby-1.9.1/usr/lib/ruby/1.9.1/mini")
ArgumentError: different prefix: "c:/" and "C:/Development/src/ruby_trunk/test/minitest"
from c:/Development/ruby/lib/ruby/1.8/pathname.rb:709:in `relative_path_from'
This breaks running the ruby tests on windows.
Updated by cfis (Charlie Savage) about 12 years ago
I was hoping we could raise the priority of this issue. This bug prevents Ruby's test suite from being run at all on windows:
:\Development\src\ruby_trunk\test>ruby runner.rb minitest\test_mini_test.rb
relative_path_from': different prefix: "c:/" and "C:/Development/src/ruby_trunk/test" (ArgumentError)class:TestMiniTest'
block in setup_argv'each'
The issues is that relative path is using case-sensitive comparisons. That's right on Linux, wrong on Windows. For whatever reason on Windows FILE returns c:.. while Dir.pwd returns C:.. And thus the problem.
I've attahced a proposed patch. If on windows (detecting mswin or mingw) then the comparison uses casecmp instead of ==. This seems like it would also apply on OS X when having a case-insensitive HFS+ drive.