mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
a34343b3a3
commit
4e58f21f79
3 changed files with 14 additions and 0 deletions
|
@ -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 = ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue