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

ruby-changes:51577

From: shyouhei <ko1@a...>
Date: Fri, 29 Jun 2018 19:28:10 +0900 (JST)
Subject: [ruby-changes:51577] shyouhei:r63788 (trunk): improve C0 coverage of insns.def

shyouhei	2018-06-29 13:56:07 +0900 (Fri, 29 Jun 2018)

  New Revision: 63788

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

  Log:
    improve C0 coverage of insns.def

  Modified files:
    trunk/bootstraptest/test_insns.rb
Index: bootstraptest/test_insns.rb
===================================================================
--- bootstraptest/test_insns.rb	(revision 63787)
+++ bootstraptest/test_insns.rb	(revision 63788)
@@ -18,7 +18,6 @@ fsl   = { frozen_string_literal: true } https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_insns.rb#L18
 tests = [
   # insn ,   expression to generate such insn
   [ 'nop',   %q{ raise rescue true }, ],
-  [ 'trace', %q{ true }, ],
 
   [ 'setlocal *, 0', %q{ x = true }, ],
   [ 'setlocal *, 1', %q{ x = nil; -> { x = true }.call }, ],
@@ -27,6 +26,27 @@ tests = [ https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_insns.rb#L26
   [ 'getlocal *, 1', %q{ x = true; -> { x }.call }, ],
   [ 'getlocal',      %q{ x = true; -> { -> { x }.() }.() }, ],
 
+  [ 'setblockparam', <<~'},', ], # {
+    def m&b
+      b = # here
+        proc { true }
+    end
+    m { false }.call
+  },
+  [ 'getblockparam', <<~'},', ], # {
+    def m&b
+      b # here
+    end
+    m { true }.call
+  },
+  [ 'getblockparamproxy', <<~'},', ], # {
+    def m&b
+      b # here
+        .call
+    end
+    m { true }
+  },
+
   [ 'setspecial', %q{ true if true..true }, ],
   [ 'getspecial', %q{ $&.nil? }, ],
   [ 'getspecial', %q{ $`.nil? }, ],
@@ -67,9 +87,10 @@ tests = [ https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_insns.rb#L87
   [ 'putiseq',                  %q{ -> { true }.() }, ],
   [ 'putstring',                %q{ "true" }, ],
   [ 'tostring / concatstrings', %q{ "#{true}" }, ],
-  [ 'freezestring',             %q{ "#{true}"}, fsl, ],
-  [ 'freezestring',             %q{ "#{true}"}, '-d', fsl, ],
+  [ 'freezestring',             %q{ "#{true}" }, fsl, ],
+  [ 'freezestring',             %q{ "#{true}" }, '-d', fsl, ],
   [ 'toregexp',                 %q{ /#{true}/ =~ "true" && $~ }, ],
+  [ 'intern',                   %q{ :"#{true}" }, ],
 
   [ 'newarray',    %q{ ["true"][0] }, ],
   [ 'duparray',    %q{ [ true ][0] }, ],
@@ -97,7 +118,6 @@ tests = [ https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_insns.rb#L118
   [ 'pop',     %q{ def x; true; end; x }, ],
   [ 'dup',     %q{ x = y = true; x }, ],
   [ 'dupn',    %q{ Object::X ||= true }, ],
-  [ 'dupn',    %q{ Object::X ||= true }, ],
   [ 'reverse', %q{ q, (w, e), r = 1, [2, 3], 4; e == 3 }, ],
   [ 'swap',    <<~'},', ],      # {
     x = [[false, true]]
@@ -113,6 +133,7 @@ tests = [ https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_insns.rb#L133
 
   [ 'defined',      %q{ !defined?(x) }, ],
   [ 'checkkeyword', %q{ def x x:rand;x end; x x: true }, ],
+  [ 'checktype',    %q{ x = true; "#{x}" }, ],
   [ 'checkmatch',   <<~'},', ], # {
     x = y = true
     case x
@@ -384,6 +405,15 @@ tests = [ https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_insns.rb#L405
     class String; def =~ other; true; end; end
     'true' =~ /true/
   },
+
+  [ 'opt_call_c_function', 'Struct.new(:x).new.x = true', ],
 ]
 
+# normal path
 tests.compact.each {|(insn, expr, *a)| assert_equal 'true', expr, insn, *a }
+
+# with trace
+tests.compact.each {|(insn, expr, *a)|
+  progn = "set_trace_func(proc{})\n" + expr
+  assert_equal 'true', progn, insn, *a
+}

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

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