diff options
| author | Daniel Bovensiepen <[email protected]> | 2012-11-17 13:54:32 +0800 |
|---|---|---|
| committer | Daniel Bovensiepen <[email protected]> | 2012-11-17 13:54:32 +0800 |
| commit | d8234a45759b3bd7b107750fda886cd828b52173 (patch) | |
| tree | 864fc0207a46d8d2511e66cd1affc53cdf3984c4 /test | |
| parent | c3bd1c1d0d43e7571bc38cfa71c40c69cea1b5a4 (diff) | |
| parent | 7cea9d7b945a4b00cef699f47c07654f8b7bd579 (diff) | |
| download | mruby-d8234a45759b3bd7b107750fda886cd828b52173.tar.gz mruby-d8234a45759b3bd7b107750fda886cd828b52173.zip | |
Merge remote-tracking branch 'upstream/master' into mrbgems
Diffstat (limited to 'test')
| -rw-r--r-- | test/t/bs_block.rb | 14 | ||||
| -rw-r--r-- | test/t/module.rb | 12 | ||||
| -rw-r--r-- | test/t/string.rb | 26 |
3 files changed, 52 insertions, 0 deletions
diff --git a/test/t/bs_block.rb b/test/t/bs_block.rb index bef9a8564..cbfb925fe 100644 --- a/test/t/bs_block.rb +++ b/test/t/bs_block.rb @@ -388,3 +388,17 @@ assert('BS Block [ruby-core:14395]') do t = Controller.new t.test_for_bug end + +assert("BS Block 32") do + module TestReturnFromNestedBlock + def self.test + 1.times do + 1.times do + return :ok + end + end + :bad + end + end + TestReturnFromNestedBlock.test == :ok +end diff --git a/test/t/module.rb b/test/t/module.rb index 1827d5758..511658150 100644 --- a/test/t/module.rb +++ b/test/t/module.rb @@ -31,6 +31,18 @@ assert('Module#append_features', '15.2.2.4.10') do Test4AppendFeatures2.const_get(:Const4AppendFeatures2) == Test4AppendFeatures2 end +assert('Module#class_variables', '15.2.2.4.19') do + class Test4ClassVariables1 + @@var1 = 1 + end + class Test4ClassVariables2 < Test4ClassVariables1 + @@var2 = 2 + end + + Test4ClassVariables1.class_variables == [:@@var1] && + Test4ClassVariables2.class_variables == [:@@var2] +end + assert('Module#const_defined?', '15.2.2.4.20') do module Test4ConstDefined Const4Test4ConstDefined = true diff --git a/test/t/string.rb b/test/t/string.rb index 26b7df584..1e921c668 100644 --- a/test/t/string.rb +++ b/test/t/string.rb @@ -61,6 +61,32 @@ assert('String#[]', '15.2.10.5.6') do a3 == 'bc' and b3 == nil end +assert('String#[] with Range') do + a1 = 'abc'[1..0] + b1 = 'abc'[1..1] + c1 = 'abc'[1..2] + d1 = 'abc'[1..3] + e1 = 'abc'[1..4] + f1 = 'abc'[0..-2] + g1 = 'abc'[-2..3] + h1 = 'abc'[3..4] + i1 = 'abc'[4..5] + a2 = 'abc'[1...0] + b2 = 'abc'[1...1] + c2 = 'abc'[1...2] + d2 = 'abc'[1...3] + e2 = 'abc'[1...4] + f2 = 'abc'[0...-2] + g2 = 'abc'[-2...3] + h2 = 'abc'[3...4] + i2 = 'abc'[4...5] + + a1 == '' and b1 == 'b' and c1 == 'bc' and d1 == 'bc' and e1 == 'bc' and + f1 == 'ab' and g1 == 'bc' and h1 == '' and i2 == nil and + a2 == '' and b2 == '' and c2 == 'b' and d2 == 'bc' and e2 == 'bc' and + f2 == 'a' and g2 == 'bc' and h2 == '' and i2 == nil +end + assert('String#capitalize', '15.2.10.5.7') do a = 'abc' a.capitalize |
