diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-05-25 23:19:35 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-05-25 23:19:35 +0900 |
| commit | 6cf5618b44962a35886629be4782c872e56ae428 (patch) | |
| tree | 49e4da9886692f364bf594c66cee1a7060d08cd9 | |
| parent | 6d6957078eb56d95af3c729bb172765bf610ef54 (diff) | |
| parent | 84116c26c9eb910a7ccdf9f49172a6c9df9dab2a (diff) | |
| download | mruby-6cf5618b44962a35886629be4782c872e56ae428.tar.gz mruby-6cf5618b44962a35886629be4782c872e56ae428.zip | |
Merge branch 'master' of github.com:mruby/mruby
| -rw-r--r-- | mrbgems/mruby-fiber/test/fiber.rb | 38 | ||||
| -rw-r--r-- | mrbgems/mruby-proc-ext/test/proc.rb | 2 | ||||
| -rw-r--r-- | test/t/enumerable.rb | 6 | ||||
| -rw-r--r-- | test/t/exception.rb | 13 | ||||
| -rw-r--r-- | test/t/proc.rb | 4 |
5 files changed, 33 insertions, 30 deletions
diff --git a/mrbgems/mruby-fiber/test/fiber.rb b/mrbgems/mruby-fiber/test/fiber.rb index c2bae2259..d063a0a62 100644 --- a/mrbgems/mruby-fiber/test/fiber.rb +++ b/mrbgems/mruby-fiber/test/fiber.rb @@ -1,12 +1,12 @@ -assert('Fiber.new') { +assert('Fiber.new') do f = Fiber.new{} - f.class == Fiber -} + assert_kind_of Fiber, f +end -assert('Fiber#resume') { - f = Fiber.new{|x| x == 2} - f.resume(2) -} +assert('Fiber#resume') do + f = Fiber.new{|x| x } + assert_equal 2, f.resume(2) +end assert('Fiber#transfer') do f2 = nil @@ -29,14 +29,13 @@ assert('Fiber#transfer') do assert_false f2.alive? end -assert('Fiber#alive?') { +assert('Fiber#alive?') do f = Fiber.new{ Fiber.yield } f.resume - r1 = f.alive? + assert_true f.alive? f.resume - r2 = f.alive? - r1 == true and r2 == false -} + assert_false f.alive? +end assert('Fiber#==') do root = Fiber.current @@ -51,16 +50,17 @@ assert('Fiber#==') do assert_true f != root end -assert('Fiber.yield') { - f = Fiber.new{|x| Fiber.yield(x == 3)} - f.resume(3) -} +assert('Fiber.yield') do + f = Fiber.new{|x| Fiber.yield x } + assert_equal 3, f.resume(3) + assert_true f.alive? +end assert('FiberError') do assert_equal StandardError, FiberError.superclass end -assert('Fiber iteration') { +assert('Fiber iteration') do f1 = Fiber.new{ [1,2,3].each{|x| Fiber.yield(x)} } @@ -72,8 +72,8 @@ assert('Fiber iteration') { a << f1.resume a << f2.resume } - a == [1,9,2,8,3,7] -} + assert_equal [1,9,2,8,3,7], a +end assert('Fiber with splat in the block argument list') { Fiber.new{|*x|x}.resume(1) == [1] diff --git a/mrbgems/mruby-proc-ext/test/proc.rb b/mrbgems/mruby-proc-ext/test/proc.rb index 0f5ecfb94..1565873a0 100644 --- a/mrbgems/mruby-proc-ext/test/proc.rb +++ b/mrbgems/mruby-proc-ext/test/proc.rb @@ -10,7 +10,7 @@ end assert('Proc#inspect') do ins = Proc.new{}.inspect - assert_true ins.kind_of? String + assert_kind_of String, ins end assert('Proc#lambda?') do diff --git a/test/t/enumerable.rb b/test/t/enumerable.rb index 4fa615a8f..5c9b14f00 100644 --- a/test/t/enumerable.rb +++ b/test/t/enumerable.rb @@ -44,7 +44,7 @@ assert('Enumerable#collect', '15.3.2.2.3') do end assert('Enumerable#detect', '15.3.2.2.4') do - assert_true [1,2,3].detect() { true } + assert_equal 1, [1,2,3].detect() { true } assert_equal 'a', [1,2,3].detect("a") { false } end @@ -63,7 +63,7 @@ assert('Enumerable#entries', '15.3.2.2.6') do end assert('Enumerable#find', '15.3.2.2.7') do - assert_true [1,2,3].find() { true } + assert_equal 1, [1,2,3].find() { true } assert_equal 'a', [1,2,3].find("a") { false } end @@ -106,7 +106,7 @@ assert('Enumerable#member?', '15.3.2.2.15') do assert_false [1,2,3,4,5,6,7,8,9].member?(0) end -assert('Enumerable#partion', '15.3.2.2.16') do +assert('Enumerable#partition', '15.3.2.2.16') do [0,1,2,3,4,5,6,7,8,9].partition do |i| i % 2 == 0 end == [[0,2,4,6,8], [1,3,5,7,9]] diff --git a/test/t/exception.rb b/test/t/exception.rb index 8aa07e813..be487162f 100644 --- a/test/t/exception.rb +++ b/test/t/exception.rb @@ -16,11 +16,14 @@ assert('Exception.exception', '15.2.22.4.1') do end assert('Exception#exception', '15.2.22.5.1') do - e1 = Exception.exception() - e2 = Exception.exception('b') - - assert_equal Exception, e1.class - assert_equal Exception, e2.class + e = Exception.new + re = RuntimeError.new + assert_equal e, e.exception + assert_equal e, e.exception(e) + assert_equal re, re.exception(re) + changed_re = re.exception('message has changed') + assert_not_equal re, changed_re + assert_equal 'message has changed', changed_re.message end assert('Exception#message', '15.2.22.5.2') do diff --git a/test/t/proc.rb b/test/t/proc.rb index e871e637e..9c1b7d4c7 100644 --- a/test/t/proc.rb +++ b/test/t/proc.rb @@ -26,8 +26,8 @@ assert('Proc#[]', '15.2.17.4.1') do b2 = Proc.new { |i| a2 += i } b2.[](5) - assert_equal a, 1 - assert_equal a2, 5 + assert_equal 1, a + assert_equal 5, a2 end assert('Proc#arity', '15.2.17.4.2') do |
