diff options
| author | Yukihiro Matz Matsumoto <[email protected]> | 2013-02-18 09:11:54 +0900 |
|---|---|---|
| committer | Yukihiro Matz Matsumoto <[email protected]> | 2013-02-18 09:11:54 +0900 |
| commit | 5568df5efee7a7220008227ea622121320c2b49b (patch) | |
| tree | 729ae20519f664d2150900e6efbb6ae63fae7626 /test | |
| parent | df38a31d3438284ff73fa691b13cb4d0a77e6520 (diff) | |
| parent | b04183fd9cc0297005fbe378d2c136516999b82a (diff) | |
| download | mruby-5568df5efee7a7220008227ea622121320c2b49b.tar.gz mruby-5568df5efee7a7220008227ea622121320c2b49b.zip | |
:Merge branch 'master' of github.com:mruby/mruby
Conflicts:
src/class.c
Diffstat (limited to 'test')
| -rw-r--r-- | test/t/module.rb | 22 | ||||
| -rw-r--r-- | test/t/string.rb | 8 |
2 files changed, 28 insertions, 2 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 diff --git a/test/t/string.rb b/test/t/string.rb index fac77075b..7d0b147d0 100644 --- a/test/t/string.rb +++ b/test/t/string.rb @@ -193,7 +193,9 @@ assert('String#eql?', '15.2.10.5.17') do end assert('String#gsub', '15.2.10.5.18') do - 'abcabc'.gsub('b', 'B') == 'aBcaBc' && 'abcabc'.gsub('b') { |w| w.capitalize } == 'aBcaBc' + 'abcabc'.gsub('b', 'B') == 'aBcaBc' and + 'abcabc'.gsub('b') { |w| w.capitalize } == 'aBcaBc' and + '#a#a#'.gsub('#', '$') == '$a$a$' end assert('String#gsub!', '15.2.10.5.19') do @@ -318,7 +320,9 @@ assert('String#split', '15.2.10.5.35') do end assert('String#sub', '15.2.10.5.36') do - 'abcabc'.sub('b', 'B') == 'aBcabc' && 'abcabc'.sub('b') { |w| w.capitalize } == 'aBcabc' + 'abcabc'.sub('b', 'B') == 'aBcabc' and + 'abcabc'.sub('b') { |w| w.capitalize } == 'aBcabc' and + 'aa#'.sub('#', '$') == 'aa$' end assert('String#sub!', '15.2.10.5.37') do |
