mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
merge revision(s) 59102: [Backport #13515]
pathname.rb: UNC root pathname needs a separator * ext/pathname/lib/pathname.rb (Pathname#plus): UNC root pathname needs a separator. File.basename returns "/" on UNC root, as well as sole drive letter, even if it does not end with a separator. [ruby-core:80900] [Bug #13515] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3fd2cbecff
commit
e52f95a68a
3 changed files with 6 additions and 4 deletions
|
@ -378,7 +378,7 @@ class Pathname
|
||||||
basename_list2.shift
|
basename_list2.shift
|
||||||
end
|
end
|
||||||
r1 = chop_basename(prefix1)
|
r1 = chop_basename(prefix1)
|
||||||
if !r1 && /#{SEPARATOR_PAT}/o =~ File.basename(prefix1)
|
if !r1 && (r1 = /#{SEPARATOR_PAT}/o =~ File.basename(prefix1))
|
||||||
while !basename_list2.empty? && basename_list2.first == '..'
|
while !basename_list2.empty? && basename_list2.first == '..'
|
||||||
index_list2.shift
|
index_list2.shift
|
||||||
basename_list2.shift
|
basename_list2.shift
|
||||||
|
|
|
@ -14,8 +14,8 @@ class TestPathname < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.get_linenum
|
def self.get_linenum
|
||||||
if /:(\d+):/ =~ caller[1]
|
if loc = caller_locations(2, 1)
|
||||||
$1.to_i
|
loc[0].lineno
|
||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
@ -221,6 +221,8 @@ class TestPathname < Test::Unit::TestCase
|
||||||
|
|
||||||
defassert(:plus, 'a//b/d//e', 'a//b/c', '../d//e')
|
defassert(:plus, 'a//b/d//e', 'a//b/c', '../d//e')
|
||||||
|
|
||||||
|
defassert(:plus, '//foo/var/bar', '//foo/var', 'bar')
|
||||||
|
|
||||||
def test_slash
|
def test_slash
|
||||||
assert_kind_of(Pathname, Pathname("a") / Pathname("b"))
|
assert_kind_of(Pathname, Pathname("a") / Pathname("b"))
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#define RUBY_VERSION "2.4.2"
|
#define RUBY_VERSION "2.4.2"
|
||||||
#define RUBY_RELEASE_DATE "2017-07-23"
|
#define RUBY_RELEASE_DATE "2017-07-23"
|
||||||
#define RUBY_PATCHLEVEL 151
|
#define RUBY_PATCHLEVEL 152
|
||||||
|
|
||||||
#define RUBY_RELEASE_YEAR 2017
|
#define RUBY_RELEASE_YEAR 2017
|
||||||
#define RUBY_RELEASE_MONTH 7
|
#define RUBY_RELEASE_MONTH 7
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue