diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-13 13:50:31 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-13 13:50:31 +0000 |
commit | 70f25096c0c389888c06e0fea358c92153633b8e (patch) | |
tree | 0f172aee9a286081cc8ffd51bfd476c10ed56c67 /test/pathname | |
parent | 800ff52c17e0036a91bfc074db51e4222d0c7b8f (diff) | |
download | ruby-70f25096c0c389888c06e0fea358c92153633b8e.tar.gz |
* lib/pathname.rb (Pathname#sub_ext): new method. [ruby-list:44608]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/pathname')
-rw-r--r-- | test/pathname/test_pathname.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb index 246b69f0e3..11c1bb7b2b 100644 --- a/test/pathname/test_pathname.rb +++ b/test/pathname/test_pathname.rb @@ -381,6 +381,17 @@ class TestPathname < Test::Unit::TestCase def pathsub(path, pat, repl) Pathname.new(path).sub(pat, repl).to_s end defassert(:pathsub, "a.o", "a.c", /\.c\z/, ".o") + def pathsubext(path, repl) Pathname.new(path).sub_ext(repl).to_s end + defassert(:pathsubext, 'a.o', 'a.c', '.o') + defassert(:pathsubext, 'a.o', 'a.c++', '.o') + defassert(:pathsubext, 'a.png', 'a.gif', '.png') + defassert(:pathsubext, 'ruby.tar.bz2', 'ruby.tar.gz', '.bz2') + defassert(:pathsubext, 'd/a.o', 'd/a.c', '.o') + defassert(:pathsubext, 'foo', 'foo.exe', '') + defassert(:pathsubext, 'lex.yy.o', 'lex.yy.c', '.o') + defassert(:pathsubext, 'fooaa.o', 'fooaa', '.o') + defassert(:pathsubext, 'd.e/aa.o', 'd.e/aa', '.o') + def root?(path) Pathname.new(path).root? end |