diff options
Diffstat (limited to 'spec/ruby/core/file/readlink_spec.rb')
-rw-r--r-- | spec/ruby/core/file/readlink_spec.rb | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/spec/ruby/core/file/readlink_spec.rb b/spec/ruby/core/file/readlink_spec.rb index 6db2c09780..b529cd1355 100644 --- a/spec/ruby/core/file/readlink_spec.rb +++ b/spec/ruby/core/file/readlink_spec.rb @@ -3,7 +3,7 @@ require File.expand_path('../../../spec_helper', __FILE__) describe "File.readlink" do # symlink/readlink are not supported on Windows platform_is_not :windows do - describe "File.readlink with absolute paths" do + describe "with absolute paths" do before :each do @file = tmp('file_readlink.txt') @link = tmp('file_readlink.lnk') @@ -35,7 +35,26 @@ describe "File.readlink" do end end - describe "File.readlink when changing the working directory" do + describe "with paths containing unicode characters" do + before :each do + @file = tmp('tàrget.txt') + @link = tmp('lïnk.lnk') + File.symlink(@file, @link) + end + + after :each do + rm_r @file, @link + end + + it "returns the name of the file referenced by the given link" do + touch @file + result = File.readlink(@link) + result.encoding.should equal Encoding.find('filesystem') + result.should == @file.dup.force_encoding(Encoding.find('filesystem')) + end + end + + describe "when changing the working directory" do before :each do @cwd = Dir.pwd @tmpdir = tmp("/readlink") |