summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-05-27 17:52:35 -0700
committerJeremy Evans <code@jeremyevans.net>2019-06-04 19:25:03 -0700
commitf1f04caf60e4fc9dc3b12109e0be831f2d692810 (patch)
tree0e6eba1746bc641b74db760133c794f7b466a4f1 /test
parent96d65274246a4be88581693f452e6b3bae9fdc5c (diff)
Include inspect value of object in FrozenError messages
FrozenError#receiver was added recently for getting the related object programmatically. However, there are cases where FrozenError is raised and not handled, and in those cases the resulting error messages lack detail, which makes debugging the error more difficult, especially in cases where the error is not easily reproducible. This includes the inspect value of the frozen object in FrozenError messages, which should make debugging simpler.
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_rubyoptions.rb2
-rw-r--r--test/ruby/test_variable.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 96edaca6f3..4fdf98fd8c 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -988,7 +988,7 @@ class TestRubyOptions < Test::Unit::TestCase
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],
diff --git a/test/ruby/test_variable.rb b/test/ruby/test_variable.rb
index a9b1fd50ff..aa301f2bc7 100644
--- a/test/ruby/test_variable.rb
+++ b/test/ruby/test_variable.rb
@@ -135,7 +135,7 @@ class TestVariable < Test::Unit::TestCase
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)