summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-02-17 16:08:35 -0800
committerYukihiro "Matz" Matsumoto <[email protected]>2013-02-17 16:08:35 -0800
commit7ef927e099078c4a8cce90b5200d4ef3f17bf681 (patch)
tree381e7ceab5ae61479959d0f3ae53726f031cfbf9
parentc6e0085e559daaa46d3143fecfaba2f599ca5b4a (diff)
parent0aa35895f9f385680cfcccd2077103cc6686ab8a (diff)
downloadmruby-7ef927e099078c4a8cce90b5200d4ef3f17bf681.tar.gz
mruby-7ef927e099078c4a8cce90b5200d4ef3f17bf681.zip
Merge pull request #846 from bovi/remove_const_doc
Add Module#remove_const Test Case
-rw-r--r--test/t/module.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/t/module.rb b/test/t/module.rb
index 286c2c085..6c1c1acda 100644
--- a/test/t/module.rb
+++ b/test/t/module.rb
@@ -241,6 +241,28 @@ assert('Module#remove_class_variable', '15.2.2.4.39') do
not Test4RemoveClassVariable.class_variables.include? :@@cv
end
+assert('Module#remove_const', '15.2.2.4.40') do
+ module Test4RemoveConst
+ ExistingConst = 23
+ end
+
+ result = Test4RemoveConst.module_eval { remove_const :ExistingConst }
+
+ name_error = false
+ begin
+ Test4RemoveConst.module_eval { remove_const :NonExistingConst }
+ rescue NameError
+ name_error = true
+ end
+
+ # Constant removed from Module
+ not Test4RemoveConst.const_defined? :ExistingConst and
+ # Return value of binding
+ result == 23 and
+ # Name Error raised when Constant doesn't exist
+ name_error
+end
+
assert('Module#remove_method', '15.2.2.4.41') do
module Test4RemoveMethod
class Parent