summaryrefslogtreecommitdiff
path: root/test/fileutils
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-17 17:59:47 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-17 17:59:47 +0000
commitace46301d8299c1e010eb7bb858bffc471be6763 (patch)
treedf3f59d53f7b087cfa6dba23615f836540810665 /test/fileutils
parent92e7c2d3eab31487164a41984a246f5809936b1a (diff)
* lib/fileutils.rb: refactored FileUtil methods to use the
`define_command` API. Patch from 7rans <transfire@gmail.com> * test/fileutils/test_dryrun.rb: corresponding test refactoring * test/fileutils/test_nowrite.rb: ditto * test/fileutils/test_verbose.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/fileutils')
-rw-r--r--test/fileutils/test_dryrun.rb7
-rw-r--r--test/fileutils/test_nowrite.rb8
-rw-r--r--test/fileutils/test_verbose.rb11
3 files changed, 15 insertions, 11 deletions
diff --git a/test/fileutils/test_dryrun.rb b/test/fileutils/test_dryrun.rb
index 85badbd..f467277 100644
--- a/test/fileutils/test_dryrun.rb
+++ b/test/fileutils/test_dryrun.rb
@@ -9,14 +9,15 @@ class TestFileUtilsDryRun < Test::Unit::TestCase
include FileUtils::DryRun
include TestFileUtils::Clobber
- def test_visibility
- FileUtils::METHODS.each do |m|
+ FileUtils::METHODS.each do |m|
+ define_method "test_singleton_visibility_#{m}" do
assert_equal true, FileUtils::DryRun.respond_to?(m, true),
"FileUtils::DryRun.#{m} not defined"
assert_equal true, FileUtils::DryRun.respond_to?(m, false),
"FileUtils::DryRun.#{m} not public"
end
- FileUtils::METHODS.each do |m|
+
+ define_method "test_instance_visibility_#{m}" do
assert_equal true, respond_to?(m, true),
"FileUtils::DryRun\##{m} is not defined"
assert_equal true, FileUtils::DryRun.private_method_defined?(m),
diff --git a/test/fileutils/test_nowrite.rb b/test/fileutils/test_nowrite.rb
index 8ca9e89..002f256 100644
--- a/test/fileutils/test_nowrite.rb
+++ b/test/fileutils/test_nowrite.rb
@@ -9,18 +9,20 @@ class TestFileUtilsNoWrite < Test::Unit::TestCase
include FileUtils::NoWrite
include TestFileUtils::Clobber
- def test_visibility
- FileUtils::METHODS.each do |m|
+ FileUtils::METHODS.each do |m|
+ define_method "test_singleton_visibility_#{m}" do
assert_equal true, FileUtils::NoWrite.respond_to?(m, true),
"FileUtils::NoWrite.#{m} is not defined"
assert_equal true, FileUtils::NoWrite.respond_to?(m, false),
"FileUtils::NoWrite.#{m} is not public"
end
- FileUtils::METHODS.each do |m|
+
+ define_method "test_instance_visibility_#{m}" do
assert_equal true, respond_to?(m, true),
"FileUtils::NoWrite\##{m} is not defined"
assert_equal true, FileUtils::NoWrite.private_method_defined?(m),
"FileUtils::NoWrite\##{m} is not private"
end
end
+
end
diff --git a/test/fileutils/test_verbose.rb b/test/fileutils/test_verbose.rb
index e60e85e..cf46fa9 100644
--- a/test/fileutils/test_verbose.rb
+++ b/test/fileutils/test_verbose.rb
@@ -7,18 +7,19 @@ class TestFileUtilsVerbose < Test::Unit::TestCase
include FileUtils::Verbose
- def test_visibility
- FileUtils::METHODS.each do |m|
+ FileUtils::METHODS.each do |m|
+ define_method "test_singleton_visibility_#{m}" do
assert_equal true, FileUtils::Verbose.respond_to?(m, true),
"FileUtils::Verbose.#{m} is not defined"
assert_equal true, FileUtils::Verbose.respond_to?(m, false),
"FileUtils::Verbose.#{m} is not public"
end
- FileUtils::METHODS.each do |m|
+
+ define_method "test_visibility_#{m}" do
assert_equal true, respond_to?(m, true),
- "FileUtils::Verbose.#{m} is not defined"
+ "FileUtils::Verbose\##{m} is not defined"
assert_equal true, FileUtils::Verbose.private_method_defined?(m),
- "FileUtils::Verbose.#{m} is not private"
+ "FileUtils::Verbose\##{m} is not private"
end
end