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

ruby-changes:54016

From: nobu <ko1@a...>
Date: Thu, 6 Dec 2018 14:29:13 +0900 (JST)
Subject: [ruby-changes:54016] nobu:r66236 (trunk): Show diff in failure messages

nobu	2018-12-06 14:29:07 +0900 (Thu, 06 Dec 2018)

  New Revision: 66236

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

  Log:
    Show diff in failure messages

  Modified files:
    trunk/test/-ext-/iseq_load/test_iseq_load.rb
Index: test/-ext-/iseq_load/test_iseq_load.rb
===================================================================
--- test/-ext-/iseq_load/test_iseq_load.rb	(revision 66235)
+++ test/-ext-/iseq_load/test_iseq_load.rb	(revision 66236)
@@ -17,27 +17,28 @@ class TestIseqLoad < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/-ext-/iseq_load/test_iseq_load.rb#L17
   end
 
   def test_stressful_roundtrip
-    assert_separately(%w[-r-test-/iseq_load], <<-'end;;', timeout: 30)
-  ISeq = RubyVM::InstructionSequence
-  def assert_iseq_roundtrip(src, line=caller_locations(1,1)[0].lineno+1)
-    a = ISeq.compile(src, __FILE__, __FILE__, line).to_a
-    b = ISeq.iseq_load(a).to_a
-    warn diff(a, b) if a != b
-    assert_equal a, b
-    assert_equal a, ISeq.iseq_load(b).to_a
-  end
-  def test_bug8543
-    assert_iseq_roundtrip "#{<<~"begin;"}\n#{<<~'end;'}"
+    assert_separately(%w[-r-test-/iseq_load], "#{<<~"begin;"}\n#{<<~'end;;'}", timeout: 30)
     begin;
-      puts "tralivali"
-      def funct(a, b)
-        a**b
+      ISeq = RubyVM::InstructionSequence
+      def assert_iseq_roundtrip(src, line=caller_locations(1,1)[0].lineno+1)
+        a = ISeq.compile(src, __FILE__, __FILE__, line).to_a
+        b = ISeq.iseq_load(a).to_a
+        assert_equal a, b, proc {diff(a, b)}
+        b = ISeq.iseq_load(b).to_a
+        assert_equal a, b, proc {diff(a, b)}
       end
-      3.times { |i| puts "Hello, world#{funct(2,i)}!" }
-    end;
-  end
-    GC.stress = true
-    test_bug8543
+      def test_bug8543
+        assert_iseq_roundtrip "#{<<~"begin;"}\n#{<<~'end;'}"
+        begin;
+          puts "tralivali"
+          def funct(a, b)
+            a**b
+          end
+          3.times { |i| puts "Hello, world#{funct(2,i)}!" }
+        end;
+      end
+      GC.stress = true
+      test_bug8543
     end;;
   end
 
@@ -80,9 +81,9 @@ class TestIseqLoad < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/-ext-/iseq_load/test_iseq_load.rb#L81
   def assert_iseq_roundtrip(src, line=caller_locations(1,1)[0].lineno+1)
     a = ISeq.compile(src, __FILE__, __FILE__, line).to_a
     b = ISeq.iseq_load(a).to_a
-    warn diff(a, b) if a != b
-    assert_equal a, b
-    assert_equal a, ISeq.iseq_load(b).to_a
+    assert_equal a, b, proc {diff(a, b)}
+    b = ISeq.iseq_load(b).to_a
+    assert_equal a, b, proc {diff(a, b)}
   end
 
   def test_next_in_block_in_block

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

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