mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	Make the mkmf methods private in the global [Bug #16896]
This commit is contained in:
		
							parent
							
								
									d99d96cc6d
								
							
						
					
					
						commit
						c2a6295ec0
					
				
					 2 changed files with 21 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -2822,7 +2822,12 @@ realclean: distclean
 | 
			
		|||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
include MakeMakefile
 | 
			
		||||
# MakeMakefile::Global = #
 | 
			
		||||
m = Module.new {
 | 
			
		||||
  include(MakeMakefile)
 | 
			
		||||
  private(*MakeMakefile.public_instance_methods(false))
 | 
			
		||||
}
 | 
			
		||||
include m
 | 
			
		||||
 | 
			
		||||
if not $extmk and /\A(extconf|makefile).rb\z/ =~ File.basename($0)
 | 
			
		||||
  END {mkmf_failed($0)}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										15
									
								
								test/mkmf/test_mkmf.rb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								test/mkmf/test_mkmf.rb
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,15 @@
 | 
			
		|||
# frozen_string_literal: false
 | 
			
		||||
require 'test/unit'
 | 
			
		||||
require 'mkmf'
 | 
			
		||||
 | 
			
		||||
class TestMkmf < Test::Unit::TestCase
 | 
			
		||||
  class TestGlobal < TestMkmf
 | 
			
		||||
    main = TOPLEVEL_BINDING.receiver
 | 
			
		||||
    MakeMakefile.public_instance_methods(false).each do |m|
 | 
			
		||||
      define_method(:"test_global_#{m}") do
 | 
			
		||||
        assert_respond_to(main, [m, true])
 | 
			
		||||
        assert_not_respond_to(main, [m, false])
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue