summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-07-29 07:05:37 +0900
committerGitHub <[email protected]>2017-07-29 07:05:37 +0900
commitb290e98f3b4e8623fd8932c9996d0481f56f766b (patch)
tree4b875e10e0037d14846999130e4f587bb23d4163 /test
parentcf23a85333c9c0ee83b0dca4c40d0d33beaf7f66 (diff)
parentf937af5745cbc6edead0ad3911bf16e08f66a96f (diff)
downloadmruby-b290e98f3b4e8623fd8932c9996d0481f56f766b.tar.gz
mruby-b290e98f3b4e8623fd8932c9996d0481f56f766b.zip
Merge pull request #3757 from christopheraue/module_const_get_class_path
Extended Module#const_get to support class paths
Diffstat (limited to 'test')
-rw-r--r--test/t/module.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/t/module.rb b/test/t/module.rb
index 7b539e683..e32cac5f1 100644
--- a/test/t/module.rb
+++ b/test/t/module.rb
@@ -268,6 +268,12 @@ assert('Module#const_get', '15.2.2.4.21') do
end
assert_equal 42, Test4ConstGet.const_get(:Const4Test4ConstGet)
+ assert_equal 42, Test4ConstGet.const_get("Const4Test4ConstGet")
+ assert_equal 42, Object.const_get("Test4ConstGet::Const4Test4ConstGet")
+
+ assert_raise(TypeError){ Test4ConstGet.const_get(123) }
+ assert_raise(NameError){ Test4ConstGet.const_get(:I_DO_NOT_EXIST) }
+ assert_raise(NameError){ Test4ConstGet.const_get("I_DO_NOT_EXIST::ME_NEITHER") }
end
assert('Module#const_missing', '15.2.2.4.22') do
@@ -280,7 +286,7 @@ assert('Module#const_missing', '15.2.2.4.22') do
assert_equal 42, Test4ConstMissing.const_get(:ConstDoesntExist)
end
-assert('Module#const_get', '15.2.2.4.23') do
+assert('Module#const_set', '15.2.2.4.23') do
module Test4ConstSet
Const4Test4ConstSet = 42
end