summaryrefslogtreecommitdiff
path: root/test/-ext-/string
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-12 09:43:05 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-12 09:43:05 +0000
commitee160e68f9fbb518d4f514987a329fc0a2332973 (patch)
tree289b86fc2f871f170569ee9c6b4c3083d4c27005 /test/-ext-/string
parent2c0d3e2a2e134a345a83ccd9a9e70af77ac4963f (diff)
class.c: no fstring singleton class
* class.c (singleton_class_of): prohibit fstrings from creating singleton classes. temporary measure for [ruby-dev:49867] [Bug #12923] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/-ext-/string')
-rw-r--r--test/-ext-/string/test_fstring.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/-ext-/string/test_fstring.rb b/test/-ext-/string/test_fstring.rb
index 39ed020..0514814 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(RuntimeError) {fstr.singleton_class}
+ end
+
class S < String
end