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

ruby-changes:36963

From: normal <ko1@a...>
Date: Sun, 28 Dec 2014 18:20:28 +0900 (JST)
Subject: [ruby-changes:36963] normal:r49044 (trunk): test_iseq_load: expand tests with stack mismatches

normal	2014-12-28 18:20:21 +0900 (Sun, 28 Dec 2014)

  New Revision: 49044

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

  Log:
    test_iseq_load: expand tests with stack mismatches
    
    We can ensure the loader works for these cases even if the
    reoptimized bytecode is not a match for the original.
    
    * test/-ext-/iseq_load/test_iseq_load.rb
      (test_next_in_block_in_block): test using ISeq#eval
      (test_break_ensure): ditto
      [ruby-core:66988]

  Modified files:
    trunk/ChangeLog
    trunk/test/-ext-/iseq_load/test_iseq_load.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 49043)
+++ ChangeLog	(revision 49044)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Dec 28 18:19:28 2014  Eric Wong  <e@8...>
+
+	* test/-ext-/iseq_load/test_iseq_load.rb
+	  (test_next_in_block_in_block): test using ISeq#eval
+	  (test_break_ensure): ditto
+	  [ruby-core:66988]
+
 Sun Dec 28 16:25:12 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* cygwin/GNUmakefile.in (EXTOBJS): override to add resource files
Index: test/-ext-/iseq_load/test_iseq_load.rb
===================================================================
--- test/-ext-/iseq_load/test_iseq_load.rb	(revision 49043)
+++ test/-ext-/iseq_load/test_iseq_load.rb	(revision 49044)
@@ -52,16 +52,21 @@ class TestIseqLoad < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/-ext-/iseq_load/test_iseq_load.rb#L52
   end
 
   def test_next_in_block_in_block
-    skip "failing due to stack_max mismatch"
-    assert_iseq_roundtrip <<-'end;'
-      3.times { 3.times { next } }
+    @next_broke = false
+    src = <<-'end;'
+      3.times { 3.times { next; @next_broke = true } }
     end;
+    a = ISeq.compile(src).to_a
+    iseq = ISeq.iseq_load(a)
+    iseq.eval
+    assert_equal false, @next_broke
+    skip "failing due to stack_max mismatch"
+    assert_iseq_roundtrip(src)
   end
 
   def test_break_ensure
-    skip "failing due to exception entry sp mismatch"
-    assert_iseq_roundtrip <<-'end;'
-      def m
+    src = <<-'end;'
+      def test_break_ensure_def_method
         bad = true
         while true
           begin
@@ -70,8 +75,15 @@ class TestIseqLoad < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/-ext-/iseq_load/test_iseq_load.rb#L75
             bad = false
           end
         end
+        bad
       end
     end;
+    a = ISeq.compile(src).to_a
+    iseq = ISeq.iseq_load(a)
+    iseq.eval
+    assert_equal false, test_break_ensure_def_method
+    skip "failing due to exception entry sp mismatch"
+    assert_iseq_roundtrip(src)
   end
 
   # FIXME: still failing

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

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