summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2016-12-03 12:01:43 +0900
committerGitHub <[email protected]>2016-12-03 12:01:43 +0900
commit9776150263d58b2b4948580201fc630eb5626bdc (patch)
tree61e765c2198f512e7e5318c88224c0f828cfd025 /test
parentd89cfca02c2f632cef443442339136b89ff15017 (diff)
parent9c61e1cd87aca3646fe39a6d53223efdcb11e250 (diff)
downloadmruby-9776150263d58b2b4948580201fc630eb5626bdc.tar.gz
mruby-9776150263d58b2b4948580201fc630eb5626bdc.zip
Merge pull request #3317 from bouk/missing-to-s
Use mrb_ptr instead of mrb_cptr in Kernel#to_s
Diffstat (limited to 'test')
-rw-r--r--test/t/kernel.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/t/kernel.rb b/test/t/kernel.rb
index d240e59dc..e59bd6a10 100644
--- a/test/t/kernel.rb
+++ b/test/t/kernel.rb
@@ -520,6 +520,21 @@ assert('Kernel#to_s', '15.3.1.3.46') do
assert_equal to_s.class, String
end
+assert('Kernel#to_s on primitives') do
+ begin
+ Fixnum.alias_method :to_s_, :to_s
+ Fixnum.remove_method :to_s
+
+ assert_nothing_raised do
+ # segfaults if mrb_cptr is used
+ 1.to_s
+ end
+ ensure
+ Fixnum.alias_method :to_s, :to_s_
+ Fixnum.remove_method :to_s_
+ end
+end
+
assert('Kernel.local_variables', '15.3.1.2.7') do
a, b = 0, 1
a += b