diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/-ext-/string/test_fstring.rb | 9 | ||||
| -rw-r--r-- | test/ruby/test_eval.rb | 8 |
2 files changed, 17 insertions, 0 deletions
diff --git a/test/-ext-/string/test_fstring.rb b/test/-ext-/string/test_fstring.rb index 39ed020892..1b3b15c922 100644 --- a/test/-ext-/string/test_fstring.rb +++ b/test/-ext-/string/test_fstring.rb @@ -1,8 +1,11 @@ # frozen_string_literal: false require 'test/unit' require '-test-/string' +require_relative '../symbol/noninterned_name' class Test_String_Fstring < Test::Unit::TestCase + include Test_Symbol::NonInterned + def assert_fstring(str) fstr = Bug::String.fstring(str) yield str @@ -54,6 +57,12 @@ class Test_String_Fstring < Test::Unit::TestCase assert_fstring(str) {|s| assert_send([s, :respond_to?, :foo])} end + def test_singleton_class + str = noninterned_name.force_encoding("us-ascii") + fstr = Bug::String.fstring(str) + assert_raise(TypeError) {fstr.singleton_class} + end + class S < String end diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb index 6982429b51..bf0a63171d 100644 --- a/test/ruby/test_eval.rb +++ b/test/ruby/test_eval.rb @@ -504,6 +504,14 @@ class TestEval < Test::Unit::TestCase assert_same a, b end + def test_fstring_instance_eval + bug = "[ruby-core:78116] [Bug #12930]".freeze + assert_same bug, (bug.instance_eval {self}) + assert_raise(RuntimeError) { + bug.instance_eval {@ivar = true} + } + end + def test_gced_binding_block assert_normal_exit %q{ def m |
