Skip to content

Commit

Permalink
Fix error with empty args.
Browse files Browse the repository at this point in the history
* ext/pathname/lib/pathname.rb (Pathname#join): Fix error with
  empty args. Reported by ko1 via IRC.

* test/pathname/test_pathname.rb (TestPathname#test_join): Add the
  test for above case.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
znz committed Apr 2, 2014
1 parent 1170b05 commit 60d4fc9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Wed Apr 2 11:46:29 2014 Kazuhiro NISHIYAMA <[email protected]>

* ext/pathname/lib/pathname.rb (Pathname#join): Fix error with
empty args. Reported by ko1 via IRC.

* test/pathname/test_pathname.rb (TestPathname#test_join): Add the
test for above case.

Tue Apr 1 11:39:57 2014 James Edward Gray II <[email protected]>

* lib/csv.rb: Symbol HeaderConverter: strip leading/trailing space.
Expand Down
1 change: 1 addition & 0 deletions ext/pathname/lib/pathname.rb
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ def plus(path1, path2) # -> path # :nodoc:
# #=> true
#
def join(*args)
return self if args.empty?
result = args.pop
result = Pathname.new(result) unless Pathname === result
return result if result.absolute?
Expand Down
2 changes: 2 additions & 0 deletions test/pathname/test_pathname.rb
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ def test_join
assert_equal(Pathname("/c"), r)
r = Pathname("/a").join("/b", "/c")
assert_equal(Pathname("/c"), r)
r = Pathname("/foo/var").join()
assert_equal(Pathname("/foo/var"), r)
end

def test_absolute
Expand Down

0 comments on commit 60d4fc9

Please sign in to comment.