file.c: join with /

* file.c (rb_file_join): join using "/" always, not a constant.
  and fix the document.  [ruby-core:79579] [Bug #13223]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-03-13 09:29:19 +00:00
parent 16e804117c
commit b75f68ab8d
2 changed files with 26 additions and 23 deletions

View file

@ -1260,6 +1260,19 @@ class TestFileExhaustive < Test::Unit::TestCase
assert_raise(Encoding::CompatibilityError, bug7168) {File.join(names)}
end
def test_join_with_changed_separator
assert_separately([], "#{<<~"begin;"}\n#{<<~"end;"}")
bug = '[ruby-core:79579] [Bug #13223]'
begin;
class File
remove_const :Separator
remove_const :SEPARATOR
end
GC.start
assert_equal("hello/world", File.join("hello", "world"), bug)
end;
end
def test_truncate
[regular_file, utf8_file].each do |file|
assert_equal(0, File.truncate(file, 1))