Project

General

Profile

Feature #15883 ยป frozen-error-message-detail.patch

jeremyevans0 (Jeremy Evans), 05/28/2019 12:55 AM

View differences:

error.c
VALUE path = rb_ary_entry(debug_info, 0);
VALUE line = rb_ary_entry(debug_info, 1);
rb_frozen_error_raise(frozen_obj,
"can't modify frozen %"PRIsVALUE", created at %"PRIsVALUE":%"PRIsVALUE,
CLASS_OF(frozen_obj), path, line);
rb_frozen_error_raise(frozen_obj,
"can't modify frozen %"PRIsVALUE": %"PRIsVALUE", created at %"PRIsVALUE":%"PRIsVALUE,
CLASS_OF(frozen_obj), rb_inspect(frozen_obj), path, line);
}
else {
rb_frozen_error_raise(frozen_obj, "can't modify frozen %"PRIsVALUE,
CLASS_OF(frozen_obj));
rb_frozen_error_raise(frozen_obj, "can't modify frozen %"PRIsVALUE": %"PRIsVALUE,
CLASS_OF(frozen_obj), rb_inspect(frozen_obj));
}
}
eval.c
goto noclass;
}
}
rb_frozen_error_raise(klass, "can't modify frozen %s", desc);
rb_frozen_error_raise(klass, "can't modify frozen %s: %"PRIsVALUE, desc, klass);
}
}
test/ruby/test_rubyoptions.rb
def test_frozen_string_literal_debug
with_debug_pat = /created at/
wo_debug_pat = /can\'t modify frozen String \(FrozenError\)\n\z/
wo_debug_pat = /can\'t modify frozen String: "\w+" \(FrozenError\)\n\z/
frozen = [
["--enable-frozen-string-literal", true],
["--disable-frozen-string-literal", false],
test/ruby/test_variable.rb
def test_special_constant_ivars
[ true, false, :symbol, "dsym#{rand(9999)}".to_sym, 1, 1.0 ].each do |v|
assert_empty v.instance_variables
msg = "can't modify frozen #{v.class}"
msg = "can't modify frozen #{v.class}: #{v.inspect}"
assert_raise_with_message(FrozenError, msg) do
v.instance_variable_set(:@foo, :bar)
    (1-1/1)