[前][次][番号順一覧][スレッド一覧]

ruby-changes:42472

From: nobu <ko1@a...>
Date: Tue, 12 Apr 2016 08:34:20 +0900 (JST)
Subject: [ruby-changes:42472] nobu:r54546 (trunk): test_optimization.rb: disasm

nobu	2016-04-12 09:30:55 +0900 (Tue, 12 Apr 2016)

  New Revision: 54546

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54546

  Log:
    test_optimization.rb: disasm
    
    * test/ruby/test_optimization.rb (disasm): dump disassembled code
      for investigation.

  Modified files:
    trunk/test/ruby/test_optimization.rb
Index: test/ruby/test_optimization.rb
===================================================================
--- test/ruby/test_optimization.rb	(revision 54545)
+++ test/ruby/test_optimization.rb	(revision 54546)
@@ -30,6 +30,10 @@ class TestRubyOptimization < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/ruby/test_optimization.rb#L30
     end;
   end
 
+  def disasm(name)
+    RubyVM::InstructionSequence.of(method(name)).disasm
+  end
+
   def test_fixnum_plus
     a, b = 1, 2
     assert_equal 3, a + b
@@ -262,7 +266,7 @@ class TestRubyOptimization < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/ruby/test_optimization.rb#L266
         fact_helper(n, 1)
       end
     EOF
-    assert_equal(9131, fact(3000).to_s.size, bug4082)
+    assert_equal(9131, fact(3000).to_s.size, message(bug4082) {disasm(:fact_helper)})
   end
 
   def test_tailcall_with_block
@@ -279,7 +283,7 @@ class TestRubyOptimization < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/ruby/test_optimization.rb#L283
         }
       end
     EOF
-    assert_equal(123, delay { 123 }.call, bug6901)
+    assert_equal(123, delay { 123 }.call, message(bug6901) {disasm(:delay)})
   end
 
   def just_yield
@@ -292,7 +296,7 @@ class TestRubyOptimization < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/ruby/test_optimization.rb#L296
         just_yield {:ok}
       end
     EOF
-    assert_equal(:ok, yield_result)
+    assert_equal(:ok, yield_result, message {disasm(:yield_result)})
   end
 
   def do_raise
@@ -314,7 +318,9 @@ class TestRubyOptimization < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/ruby/test_optimization.rb#L318
         errinfo
       end
     end;
-    result = to_be_rescued
+    result = assert_nothing_raised(RuntimeError, message(bug12082) {disasm(:to_be_rescued)}) {
+      to_be_rescued
+    }
     assert_instance_of(RuntimeError, result, bug12082)
     assert_equal("should be rescued", result.message, bug12082)
   end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]