diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-04-19 13:33:18 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-04-19 13:33:18 +0000 |
commit | 22bdfe14138a950765a8fc66c149a3f840cd5424 (patch) | |
tree | fa841741d91b90c90c62cd0c060aa60ecc89f771 /test | |
parent | 3867806101e9ef7bfd7c23cdfa28ffb122c30691 (diff) |
merges r22987 from trunk into ruby_1_9_1.
--
* lib/pathname.rb (Pathname#sub): set $~ in block.binding.
[ruby-dev:38173]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@23217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/pathname/test_pathname.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb index da12383bdd..c2ce292deb 100644 --- a/test/pathname/test_pathname.rb +++ b/test/pathname/test_pathname.rb @@ -392,6 +392,15 @@ class TestPathname < Test::Unit::TestCase defassert(:pathsubext, 'fooaa.o', 'fooaa', '.o') defassert(:pathsubext, 'd.e/aa.o', 'd.e/aa', '.o') + def test_sub_matchdata + result = Pathname("abc.gif").sub(/\..*/) { + assert_not_nil($~) + assert_equal(".gif", $~[0]) + ".png" + } + assert_equal("abc.png", result.to_s) + end + def root?(path) Pathname.new(path).root? end |