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 | e13d02d746bf17226c6cb6b1f68ab7fa27c31fbf (patch) | |
| tree | 0f172aee9a286081cc8ffd51bfd476c10ed56c67 /test | |
| parent | 4202879723a9916af9c44bca00b804d2c8f979b0 (diff) | |
| download | ruby-e13d02d746bf17226c6cb6b1f68ab7fa27c31fbf.tar.gz ruby-e13d02d746bf17226c6cb6b1f68ab7fa27c31fbf.tar.xz ruby-e13d02d746bf17226c6cb6b1f68ab7fa27c31fbf.zip | |
* lib/pathname.rb (Pathname#sub_ext): new method. [ruby-list:44608]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
| -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 246b69f0e..11c1bb7b2 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 |
