mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	metaprogramming in FileUtils occurred. [ruby-trunk - Bug #7958] * test/fileutils/visibility_tests.rb: Refactored tests of FileUtils options modules to expose bug found in #7958 * test/fileutils/test_dryrun.rb: ditto. * test/fileutils/test_nowrite.rb: ditto. * test/fileutils/test_verbose.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
		
			
				
	
	
		
			41 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
require 'test/unit'
 | 
						|
require 'fileutils'
 | 
						|
 | 
						|
class TestFileUtils < Test::Unit::TestCase
 | 
						|
end
 | 
						|
 | 
						|
##
 | 
						|
# These tests are reused in the FileUtils::Verbose, FileUtils::NoWrite and
 | 
						|
# FileUtils::DryRun tests
 | 
						|
 | 
						|
module TestFileUtils::Visibility
 | 
						|
 | 
						|
  FileUtils::METHODS.each do |m|
 | 
						|
    define_method "test_singleton_visibility_#{m}" do
 | 
						|
      assert @fu_module.respond_to?(m, true),
 | 
						|
             "FileUtils::Verbose.#{m} is not defined"
 | 
						|
      assert @fu_module.respond_to?(m, false),
 | 
						|
             "FileUtils::Verbose.#{m} is not public"
 | 
						|
    end
 | 
						|
 | 
						|
    define_method "test_visibility_#{m}" do
 | 
						|
      assert respond_to?(m, true),
 | 
						|
             "FileUtils::Verbose\##{m} is not defined"
 | 
						|
      assert @fu_module.private_method_defined?(m),
 | 
						|
             "FileUtils::Verbose\##{m} is not private"
 | 
						|
    end
 | 
						|
  end
 | 
						|
 | 
						|
  FileUtils::StreamUtils_.private_instance_methods.each do |m|
 | 
						|
    define_method "test_singleton_visibility_#{m}" do
 | 
						|
      assert @fu_module.respond_to?(m, true),
 | 
						|
             "FileUtils::Verbose\##{m} is not defined"
 | 
						|
    end
 | 
						|
 | 
						|
    define_method "test_visibility_#{m}" do
 | 
						|
      assert respond_to?(m, true),
 | 
						|
             "FileUtils::Verbose\##{m} is not defined"
 | 
						|
    end
 | 
						|
  end
 | 
						|
 | 
						|
end
 |