diff options
| author | Christopher Aue <[email protected]> | 2017-07-28 22:46:26 +0200 |
|---|---|---|
| committer | Christopher Aue <[email protected]> | 2017-07-28 23:19:49 +0200 |
| commit | f937af5745cbc6edead0ad3911bf16e08f66a96f (patch) | |
| tree | da80d7e0bb43d7245850bf0a708812f0aa48d0e9 /test/t | |
| parent | c7018ea9627efd9c6fe4ef6b6f459fefef01fc52 (diff) | |
| download | mruby-f937af5745cbc6edead0ad3911bf16e08f66a96f.tar.gz mruby-f937af5745cbc6edead0ad3911bf16e08f66a96f.zip | |
Extended Module#const_get to support class paths
Diffstat (limited to 'test/t')
| -rw-r--r-- | test/t/module.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/t/module.rb b/test/t/module.rb index 419b0bfd5..04fa8d102 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 |
