Raising Errno::ENOENT exception with a particular path instead of src, which may be an array.

Closes #59
This commit is contained in:
Mariusz Pietrzyk 2010-12-28 10:25:19 +01:00 committed by Scott Taylor
parent 3916ffc91d
commit 8bf4b5aeb0
2 changed files with 6 additions and 3 deletions

View File

@ -102,7 +102,7 @@ module FakeFS
FileSystem.add(dest_path, target.entry.clone) FileSystem.add(dest_path, target.entry.clone)
FileSystem.delete(path) FileSystem.delete(path)
else else
raise Errno::ENOENT, src raise Errno::ENOENT, path
end end
end end
end end

View File

@ -568,7 +568,6 @@ class FakeFSTest < Test::Unit::TestCase
assert_equal ['/path', '/path/bar', '/path/bar/baz', '/path/bar2', '/path/bar2/baz', '/path/foo', '/path/foobar'], Dir['/**/*'] assert_equal ['/path', '/path/bar', '/path/bar/baz', '/path/bar2', '/path/bar2/baz', '/path/foo', '/path/foobar'], Dir['/**/*']
assert_equal ['/path/bar', '/path/bar/baz', '/path/bar2', '/path/bar2/baz', '/path/foo', '/path/foobar'], Dir['/path/**/*'] assert_equal ['/path/bar', '/path/bar/baz', '/path/bar2', '/path/bar2/baz', '/path/foo', '/path/foobar'], Dir['/path/**/*']
assert_equal ['/path/bar/baz'], Dir['/path/bar/**/*'] assert_equal ['/path/bar/baz'], Dir['/path/bar/**/*']
FileUtils.cp_r '/path', '/otherpath' FileUtils.cp_r '/path', '/otherpath'
@ -803,6 +802,10 @@ class FakeFSTest < Test::Unit::TestCase
assert_raise(Errno::ENOENT) do assert_raise(Errno::ENOENT) do
FileUtils.mv 'blafgag', 'foo' FileUtils.mv 'blafgag', 'foo'
end end
exception = assert_raise(Errno::ENOENT) do
FileUtils.mv ['foo', 'bar'], 'destdir'
end
assert_equal "No such file or directory - foo", exception.message
end end
def test_mv_actually_works def test_mv_actually_works