style tweaks

This commit is contained in:
Chris Wanstrath 2009-09-21 19:42:23 -07:00
parent 0124b3ab89
commit fa89049964

View File

@ -65,9 +65,9 @@ class FakeFSTest < Test::Unit::TestCase
FileUtils.ln_s(target, "/path/to/link") FileUtils.ln_s(target, "/path/to/link")
assert_kind_of FakeSymlink, FileSystem.fs['path']['to']['link'] assert_kind_of FakeSymlink, FileSystem.fs['path']['to']['link']
assert_raises(Errno::EEXIST) { assert_raises(Errno::EEXIST) do
FileUtils.ln_s(target, '/path/to/link') FileUtils.ln_s(target, '/path/to/link')
} end
end end
def test_can_follow_symlinks def test_can_follow_symlinks
@ -171,7 +171,8 @@ class FakeFSTest < Test::Unit::TestCase
bad = 'nofile.txt' bad = 'nofile.txt'
File.open(good,'w') { |f| f.write "foo" } File.open(good,'w') { |f| f.write "foo" }
assert_equal [good], FileUtils.chown('noone', 'nogroup', good, :verbose => true) out = FileUtils.chown('noone', 'nogroup', good, :verbose => true)
assert_equal [good], out
assert_raises(Errno::ENOENT) do assert_raises(Errno::ENOENT) do
FileUtils.chown('noone', 'nogroup', bad, :verbose => true) FileUtils.chown('noone', 'nogroup', bad, :verbose => true)
end end
@ -433,9 +434,9 @@ class FakeFSTest < Test::Unit::TestCase
assert_equal 'footext', File.open('baz/subdir/foo') { |f| f.read } assert_equal 'footext', File.open('baz/subdir/foo') { |f| f.read }
# To a subdirectory of a directory that does not exist # To a subdirectory of a directory that does not exist
assert_raises(Errno::ENOENT) { assert_raises(Errno::ENOENT) do
FileUtils.cp_r('subdir', 'nope/something') FileUtils.cp_r('subdir', 'nope/something')
} end
end end
def test_cp_r_only_copies_into_directories def test_cp_r_only_copies_into_directories
@ -527,15 +528,15 @@ class FakeFSTest < Test::Unit::TestCase
end end
def test_touch_does_not_work_if_the_dir_path_cannot_be_found def test_touch_does_not_work_if_the_dir_path_cannot_be_found
assert_raises(Errno::ENOENT) { assert_raises(Errno::ENOENT) do
FileUtils.touch('this/path/should/not/be/here') FileUtils.touch('this/path/should/not/be/here')
} end
FileUtils.mkdir_p('subdir') FileUtils.mkdir_p('subdir')
list = ['subdir/foo', 'nosubdir/bar'] list = ['subdir/foo', 'nosubdir/bar']
assert_raises(Errno::ENOENT) { assert_raises(Errno::ENOENT) do
FileUtils.touch(list) FileUtils.touch(list)
} end
end end
def test_extname def test_extname
@ -546,15 +547,15 @@ class FakeFSTest < Test::Unit::TestCase
def test_new_directory def test_new_directory
FileUtils.mkdir_p('/this/path/should/be/here') FileUtils.mkdir_p('/this/path/should/be/here')
assert_nothing_raised { assert_nothing_raised do
Dir.new('/this/path/should/be/here') Dir.new('/this/path/should/be/here')
} end
end end
def test_new_directory_does_not_work_if_dir_path_cannot_be_found def test_new_directory_does_not_work_if_dir_path_cannot_be_found
assert_raises(Errno::ENOENT) { assert_raises(Errno::ENOENT) do
Dir.new('/this/path/should/not/be/here') Dir.new('/this/path/should/not/be/here')
} end
end end
def test_directory_close def test_directory_close
@ -562,9 +563,9 @@ class FakeFSTest < Test::Unit::TestCase
dir = Dir.new('/this/path/should/be/here') dir = Dir.new('/this/path/should/be/here')
assert dir.close.nil? assert dir.close.nil?
assert_raises(IOError) { assert_raises(IOError) do
dir.each { |dir| dir } dir.each { |dir| dir }
} end
end end
def test_directory_each def test_directory_each
@ -589,7 +590,8 @@ class FakeFSTest < Test::Unit::TestCase
def test_directory_path def test_directory_path
FileUtils.mkdir_p('/this/path/should/be/here') FileUtils.mkdir_p('/this/path/should/be/here')
assert Dir.new('/this/path/should/be/here').path == '/this/path/should/be/here' good_path = '/this/path/should/be/here'
assert_equal good_path, Dir.new('/this/path/should/be/here').path
end end
def test_directory_pos def test_directory_pos