@@ -52,15 +52,15 @@ def test_long
5252
5353 def test_float
5454 assert_correct_type :float , 1.0
55- assert_correct_type :float , Math ::PI , "Math::PI"
55+ assert_correct_type :float , Math ::PI
5656 assert_wrong_type :float , 1
5757 assert_wrong_type :float , "not float"
5858 assert_wrong_type :float , nil
5959 end
6060
6161 def test_double
6262 assert_correct_type :double , 1.0
63- assert_correct_type :double , Math ::PI , "Math::PI"
63+ assert_correct_type :double , Math ::PI
6464 assert_wrong_type :double , 1
6565 assert_wrong_type :double , "not double"
6666 assert_wrong_type :double , nil
@@ -76,7 +76,7 @@ def test_bool
7676 def test_char
7777 assert_correct_type :char , 'a'
7878 assert_correct_type :char , '☃'
79- assert_correct_type :char , '☃' , '"\u2603"'
79+ assert_correct_type :char , '☃'
8080 assert_wrong_type :char , 1
8181 assert_wrong_type :char , "not char"
8282 assert_wrong_type :char , nil
@@ -88,28 +88,28 @@ def test_user_type
8888 user_type = new UserType ( )
8989 Type . define_new ( :UserType , UserType )
9090
91- assert_correct_type :UserType , user_type , "ObjectSpace._id2ref( #{ user_type . __id__ } )"
91+ assert_correct_type :UserType , user_type
9292 assert_wrong_type :UserType , 1
9393 assert_wrong_type :UserType , "not UserType"
9494 assert_wrong_type :UserType , nil
9595 end
9696
9797 private
98- def define_test_method ( type , val , raw_val = nil )
98+ def define_test_method ( type , val )
9999 klass = Class . new . class_eval <<-RUBY_CODE
100100 public #{ type } def call
101- #{ raw_val ? raw_val : val . inspect }
101+ ObjectSpace._id2ref( #{ val . __id__ } )
102102 end
103103 RUBY_CODE
104104
105105 klass . new
106106 end
107107
108- def assert_correct_type ( type , val , raw_val = nil )
109- assert_equal val , define_test_method ( type , val , raw_val ) . call
108+ def assert_correct_type ( type , val )
109+ assert_equal val , define_test_method ( type , val ) . call
110110 end
111111
112- def assert_wrong_type ( type , val , raw_val = nil )
113- assert_raises ( TypeError ) { define_test_method ( type , val , raw_val ) . call }
112+ def assert_wrong_type ( type , val )
113+ assert_raises ( TypeError ) { define_test_method ( type , val ) . call }
114114 end
115115end
0 commit comments