1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/fileutils/visibility_tests.rb
Jeremy Evans ab3cb29bd9 Avoid defining the same test class in multiple files
Should fix issues with parallel testing sometimes not running all
tests.

This should be viewed skipping whitespace changes.

Fixes [Bug #18731]
2022-04-22 15:00:16 -07:00

39 lines
1.1 KiB
Ruby

# frozen_string_literal: true
require 'test/unit'
require 'fileutils'
##
# These tests are reused in the FileUtils::Verbose, FileUtils::NoWrite and
# FileUtils::DryRun tests
module TestFileUtilsIncVisibility
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