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

ruby-changes:53849

From: normal <ko1@a...>
Date: Wed, 28 Nov 2018 13:31:48 +0900 (JST)
Subject: [ruby-changes:53849] normal:r66067 (trunk): test_settracefunc (test_tracepoint_enable_with_target_line): less fragile

normal	2018-11-28 13:31:42 +0900 (Wed, 28 Nov 2018)

  New Revision: 66067

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

  Log:
    test_settracefunc (test_tracepoint_enable_with_target_line): less fragile
    
    Allow us to make other changes to the file and move the method
    around without affecting this test.

  Modified files:
    trunk/test/ruby/test_settracefunc.rb
Index: test/ruby/test_settracefunc.rb
===================================================================
--- test/ruby/test_settracefunc.rb	(revision 66066)
+++ test/ruby/test_settracefunc.rb	(revision 66067)
@@ -2059,6 +2059,7 @@ class TestSetTraceFunc < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/ruby/test_settracefunc.rb#L2059
 
   def test_tracepoint_enable_with_target_line
     events = []
+    line_0 = __LINE__
     code1 = proc{
       events << 1
       events << 2
@@ -2067,7 +2068,7 @@ class TestSetTraceFunc < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/ruby/test_settracefunc.rb#L2068
     tp = TracePoint.new(:line) do |tp|
       events << :tp
     end
-    tp.enable(target: code1, target_line: 2064) do
+    tp.enable(target: code1, target_line: line_0 + 3) do
       code1.call
     end
     assert_equal [1, :tp, 2, 3], events

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

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