summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/pathname/lib/pathname.rb2
-rw-r--r--test/pathname/test_pathname.rb6
-rw-r--r--version.h2
3 files changed, 6 insertions, 4 deletions
diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb
index a6621565d0..8bdb73f439 100644
--- a/ext/pathname/lib/pathname.rb
+++ b/ext/pathname/lib/pathname.rb
@@ -378,7 +378,7 @@ class Pathname
basename_list2.shift
end
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 == '..'
index_list2.shift
basename_list2.shift
diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb
index 848d4e4190..1efd40121d 100644
--- a/test/pathname/test_pathname.rb
+++ b/test/pathname/test_pathname.rb
@@ -14,8 +14,8 @@ class TestPathname < Test::Unit::TestCase
end
def self.get_linenum
- if /:(\d+):/ =~ caller[1]
- $1.to_i
+ if loc = caller_locations(2, 1)
+ loc[0].lineno
else
nil
end
@@ -221,6 +221,8 @@ class TestPathname < Test::Unit::TestCase
defassert(:plus, 'a//b/d//e', 'a//b/c', '../d//e')
+ defassert(:plus, '//foo/var/bar', '//foo/var', 'bar')
+
def test_slash
assert_kind_of(Pathname, Pathname("a") / Pathname("b"))
end
diff --git a/version.h b/version.h
index 1faf0321f3..6328d73b36 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.4.2"
#define RUBY_RELEASE_DATE "2017-07-23"
-#define RUBY_PATCHLEVEL 151
+#define RUBY_PATCHLEVEL 152
#define RUBY_RELEASE_YEAR 2017
#define RUBY_RELEASE_MONTH 7