aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-24 07:35:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-24 07:35:38 +0000
commit71cfd5e3360f8e61c8052da5aab64d9982f46fa2 (patch)
treeef2f5c13c66348678aade546cbaad359e2391355 /test
parent5bfd40e38cb50a619c0d222472ad692f1d3555cb (diff)
downloadruby-71cfd5e3360f8e61c8052da5aab64d9982f46fa2.tar.gz
Add tests for `File.extname`
* file.c (rb_file_s_extname): [DOC] add an example. * test/ruby/test_path.rb (test_extname): add tests. [Fix GH-978] * path starts with dot ('.a.rb') * path includes dir name ('a/b/d/test.rb') * path includes dir name and dir name starts with dot ('.a/b/d/test.rb') git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_path.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/ruby/test_path.rb b/test/ruby/test_path.rb
index 2db7be0b76..b604a763f1 100644
--- a/test/ruby/test_path.rb
+++ b/test/ruby/test_path.rb
@@ -230,6 +230,9 @@ class TestPath < Test::Unit::TestCase
assert_equal('', File.extname('a'))
ext = '.rb'
assert_equal(ext, File.extname('a.rb'))
+ assert_equal(ext, File.extname('.a.rb'))
+ assert_equal(ext, File.extname('a/b/d/test.rb'))
+ assert_equal(ext, File.extname('.a/b/d/test.rb'))
unless /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
# trailing spaces and dots are ignored on NTFS.
ext = ''