aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_file_exhaustive.rb10
-rw-r--r--test/ruby/test_path.rb8
2 files changed, 12 insertions, 6 deletions
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb
index 6b80b82389..4bb5479303 100644
--- a/test/ruby/test_file_exhaustive.rb
+++ b/test/ruby/test_file_exhaustive.rb
@@ -1308,21 +1308,23 @@ class TestFileExhaustive < Test::Unit::TestCase
assert_equal(".test", File.extname(regular_file))
assert_equal(".test", File.extname(utf8_file))
prefixes = ["", "/", ".", "/.", "bar/.", "/bar/."]
- infixes = ["", " ", "."]
+ infixes = ["", " "]
infixes2 = infixes + [".ext "]
appendixes = [""]
if NTFS
appendixes << " " << "." << "::$DATA" << "::$DATA.bar"
+ else
+ appendixes << [".", "."]
end
prefixes.each do |prefix|
- appendixes.each do |appendix|
+ appendixes.each do |appendix, ext = ""|
infixes.each do |infix|
path = "#{prefix}foo#{infix}#{appendix}"
- assert_equal("", File.extname(path), "File.extname(#{path.inspect})")
+ assert_equal(ext, File.extname(path), "File.extname(#{path.inspect})")
end
infixes2.each do |infix|
path = "#{prefix}foo#{infix}.ext#{appendix}"
- assert_equal(".ext", File.extname(path), "File.extname(#{path.inspect})")
+ assert_equal(ext.empty? ? ".ext" : appendix, File.extname(path), "File.extname(#{path.inspect})")
end
end
end
diff --git a/test/ruby/test_path.rb b/test/ruby/test_path.rb
index 6af4fb6ac0..b35e942a2a 100644
--- a/test/ruby/test_path.rb
+++ b/test/ruby/test_path.rb
@@ -236,10 +236,14 @@ class TestPath < Test::Unit::TestCase
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 = ''
+ ext = '.'
end
assert_equal(ext, File.extname('a.rb.'))
- assert_equal('', File.extname('a.'))
+ if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
+ # trailing spaces and dots are ignored on NTFS.
+ ext = ''
+ end
+ assert_equal(ext, File.extname('a.'))
assert_equal('', File.extname('.x'))
assert_equal('', File.extname('..x'))
end