File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -725,7 +725,7 @@ bind_implicit_parameter_get(VALUE bindval, VALUE sym)
725725
726726 if (!lid || !rb_implicit_param_p (lid )) {
727727 rb_name_err_raise ("'%1$s' is not an implicit parameter" ,
728- bindval , ID2SYM ( lid ) );
728+ bindval , sym );
729729 }
730730
731731 GetBindingPtr (bindval , bind );
@@ -774,7 +774,7 @@ bind_implicit_parameter_defined_p(VALUE bindval, VALUE sym)
774774
775775 if (!lid || !rb_implicit_param_p (lid )) {
776776 rb_name_err_raise ("'%1$s' is not an implicit parameter" ,
777- bindval , ID2SYM ( lid ) );
777+ bindval , sym );
778778 }
779779
780780 GetBindingPtr (bindval , bind );
Original file line number Diff line number Diff line change @@ -1913,6 +1913,14 @@ def test_implicit_parameters_for_it_and_numparams
19131913 end
19141914 end
19151915
1916+ def test_implicit_parameter_invalid_name
1917+ message_pattern = /is not an implicit parameter/
1918+ assert_raise_with_message ( NameError , message_pattern ) { binding . implicit_parameter_defined? ( :foo ) }
1919+ assert_raise_with_message ( NameError , message_pattern ) { binding . implicit_parameter_get ( :foo ) }
1920+ assert_raise_with_message ( NameError , message_pattern ) { binding . implicit_parameter_defined? ( "wrong_implicit_parameter_name_#{ rand ( 10000 ) } " ) }
1921+ assert_raise_with_message ( NameError , message_pattern ) { binding . implicit_parameter_get ( "wrong_implicit_parameter_name_#{ rand ( 10000 ) } " ) }
1922+ end
1923+
19161924 def test_local_variable_set_wb
19171925 assert_ruby_status ( [ ] , <<-'end;' , '[Bug #13605]' , timeout : 30 )
19181926 b = binding
You can’t perform that action at this time.
0 commit comments