From 70f25096c0c389888c06e0fea358c92153633b8e Mon Sep 17 00:00:00 2001 From: akr Date: Wed, 13 Feb 2008 13:50:31 +0000 Subject: * 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 --- test/pathname/test_pathname.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/pathname/test_pathname.rb') 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 -- cgit v1.2.3