mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	enumerator.c: undef new and allocate of ArithmeticSequence
Undefine new and allocate methods of Enumerator::ArithmeticSequence. [ruby-core:82816] [Feature #13904] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									ed4e38c4b0
								
							
						
					
					
						commit
						25a5227ab1
					
				
					 2 changed files with 10 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -2844,6 +2844,8 @@ InitVM_Enumerator(void)
 | 
			
		|||
 | 
			
		||||
    /* ArithmeticSequence */
 | 
			
		||||
    rb_cArithSeq = rb_define_class_under(rb_cEnumerator, "ArithmeticSequence", rb_cEnumerator);
 | 
			
		||||
    rb_undef_alloc_func(rb_cArithSeq);
 | 
			
		||||
    rb_undef_method(CLASS_OF(rb_cArithSeq), "new");
 | 
			
		||||
    rb_define_method(rb_cArithSeq, "begin", arith_seq_begin, 0);
 | 
			
		||||
    rb_define_method(rb_cArithSeq, "end", arith_seq_end, 0);
 | 
			
		||||
    rb_define_method(rb_cArithSeq, "exclude_end?", arith_seq_exclude_end, 0);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,14 @@
 | 
			
		|||
require 'test/unit'
 | 
			
		||||
 | 
			
		||||
class TestArithmeticSequence < Test::Unit::TestCase
 | 
			
		||||
  def test_new
 | 
			
		||||
    assert_raise(NoMethodError) { Enumerator::ArithmeticSequence.new }
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_allocate
 | 
			
		||||
    assert_raise(TypeError) { Enumerator::ArithmeticSequence.allocate }
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_begin
 | 
			
		||||
    assert_equal(1, 1.step.begin)
 | 
			
		||||
    assert_equal(1, 1.step(10).begin)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue