Fixing cp_r sharing data between files copied
This commit is contained in:
parent
b5e7359eac
commit
35c2da972b
@ -24,7 +24,7 @@ module FakeFS
|
||||
|
||||
def cp_r(src, dest)
|
||||
if dir = FileSystem.find(src)
|
||||
FileSystem.add(dest, dir.entry)
|
||||
FileSystem.add(dest, dir.entry.clone)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -271,4 +271,11 @@ class FakeFSTest < Test::Unit::TestCase
|
||||
FileUtils.mv 'foo', 'baz'
|
||||
assert_equal 'bar', File.open('baz'){|f| f.read }
|
||||
end
|
||||
|
||||
def test_cp_r_doesnt_tangle_files_together
|
||||
File.open('foo', 'w') {|f| f.write 'bar' }
|
||||
FileUtils.cp_r('foo', 'baz')
|
||||
File.open('baz', 'w') {|f| f.write 'quux' }
|
||||
assert_equal 'bar', File.open('foo'){|f| f.read }
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user