mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	object.c: no TypeError at Symbol
* object.c (special_object_p): uninterned Symbol also should not raise a TypeError but return itself instead, as well as interned Symbols. [ruby-core:79216] [Bug #13145] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									5bb125c63e
								
							
						
					
					
						commit
						11e6bd5ac2
					
				
					 2 changed files with 5 additions and 0 deletions
				
			
		
							
								
								
									
										1
									
								
								object.c
									
										
									
									
									
								
							
							
						
						
									
										1
									
								
								object.c
									
										
									
									
									
								
							|  | @ -304,6 +304,7 @@ special_object_p(VALUE obj) | ||||||
|     switch (BUILTIN_TYPE(obj)) { |     switch (BUILTIN_TYPE(obj)) { | ||||||
|       case T_BIGNUM: |       case T_BIGNUM: | ||||||
|       case T_FLOAT: |       case T_FLOAT: | ||||||
|  |       case T_SYMBOL: | ||||||
| 	return TRUE; | 	return TRUE; | ||||||
|       default: |       default: | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
|  |  | ||||||
|  | @ -23,6 +23,8 @@ class TestObject < Test::Unit::TestCase | ||||||
|     assert_equal true, true.dup |     assert_equal true, true.dup | ||||||
|     assert_equal nil, nil.dup |     assert_equal nil, nil.dup | ||||||
|     assert_equal false, false.dup |     assert_equal false, false.dup | ||||||
|  |     x = :x; assert_equal x, x.dup | ||||||
|  |     x = "bug13145".intern; assert_equal x, x.dup | ||||||
|     x = 1 << 64; assert_equal x, x.dup |     x = 1 << 64; assert_equal x, x.dup | ||||||
|     x = 1.72723e-77; assert_equal x, x.dup |     x = 1.72723e-77; assert_equal x, x.dup | ||||||
| 
 | 
 | ||||||
|  | @ -51,6 +53,8 @@ class TestObject < Test::Unit::TestCase | ||||||
|     assert_equal true, true.clone |     assert_equal true, true.clone | ||||||
|     assert_equal nil, nil.clone |     assert_equal nil, nil.clone | ||||||
|     assert_equal false, false.clone |     assert_equal false, false.clone | ||||||
|  |     x = :x; assert_equal x, x.dup | ||||||
|  |     x = "bug13145".intern; assert_equal x, x.dup | ||||||
|     x = 1 << 64; assert_equal x, x.clone |     x = 1 << 64; assert_equal x, x.clone | ||||||
|     x = 1.72723e-77; assert_equal x, x.clone |     x = 1.72723e-77; assert_equal x, x.clone | ||||||
|     assert_raise(ArgumentError) {1.clone(freeze: false)} |     assert_raise(ArgumentError) {1.clone(freeze: false)} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 nobu
						nobu