Skip to content

Instantly share code, notes, and snippets.

@jesjos
Created April 30, 2015 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jesjos/42abb409295c4614d200 to your computer and use it in GitHub Desktop.
Save jesjos/42abb409295c4614d200 to your computer and use it in GitHub Desktop.
Possible JRuby bug
require 'minitest/autorun'
describe 'File.expand_path under windows' do
describe 'when given a path using backslashes' do
before { @unc_path = '\\Machine\Share\resource' }
it 'expands to the correct path when given a UNC network path and a relative path' do
File.expand_path('..', @unc_path).must_equal('//Machine/Share')
end
it 'expands to the same path when given a UNC path only' do
File.expand_path(@unc_path).must_equal('//Machine/Share/resource')
end
end
describe 'when given a path using forward slashes' do
before { @unc_path = '//Machine/Share/resource' }
it 'expands to the correct path when given a UNC network path and a relative path' do
File.expand_path('..', @unc_path).must_equal('//Machine/Share')
end
it 'expands to the same path when given a UNC path only' do
File.expand_path(@unc_path).must_equal('//Machine/Share/resource')
end
end
end
# Running tests:
# FFF.
# Finished tests in 0.047000s, 85.1064 tests/s, 85.1064 assertions/s.
# 1) Failure:
# test_0001_expands_to_the_correct_path_when_given_a_unc_network_path_and_a_relative_path(File.expand_path under windows::when given a path using backslashes) [jruby_expand_path_test.rb:8]:
# Expected: "//Machine/Share"
# Actual: "C:/Machine/Share"
# 2) Failure:
# test_0002_expands_to_the_same_path_when_given_a_unc_path_only(File.expand_path under windows::when given a path using backslashes) [jruby_expand_path_test.rb:12]:
# Expected: "//Machine/Share/resource"
# Actual: "C:/Machine/Share/resource"
# 3) Failure:
# test_0001_expands_to_the_correct_path_when_given_a_unc_network_path_and_a_relative_path(File.expand_path under windows::when given a path using forward slashes) [jruby_expand_path_test.rb:20]:
# Expected: "//Machine/Share"
# Actual: "C:/Work/Machine/Share"
# 4 tests, 4 assertions, 3 failures, 0 errors, 0 skips
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment