[ruby-core:96173] [Ruby master Bug#16399] TracePoint.stat disappeared in Ruby-2.7.0-preview3

[email protected]
Newsgroups gmane.comp.lang.ruby.core
Message-ID <redmine.journal-83049.20191209183823.dad03a41f2e83cf1@ruby-lang.org>
Issue #16399 has been updated by alanwu (Alan Wu).


Thank you for taking the time to test out 2.7.0-preview3!

----------------------------------------
Bug #16399: TracePoint.stat disappeared in Ruby-2.7.0-preview3
https://bugs.ruby-lang.org/issues/16399#change-83049

* Author: TOKI.Yoshinori (仁謙 土岐)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.7.0preview3 (2019-11-23 master b563439274) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
`TracePoint.stat` method that existed in Ruby 2.6 (including 2.7.0-preview2) no longer exists in Ruby 2.7.0-preview3, but instead, `TracePoint#stat` method that did not exist so far has been added.

Test Script:

```ruby
#!/usr/bin/env ruby

require 'test/unit'

class TracePointTest < Test::Unit::TestCase
  test 'TracePoint.stat' do
    assert_respond_to(TracePoint, :stat)
  end

  test 'no TracePoint#stat' do
    assert_not_respond_to(TracePoint.new{}, :stat)
  end
end

```

Output (Ruby 2.7.0-preview3):

```
$ ruby -v
ruby 2.7.0preview3 (2019-11-23 master b563439274) [x86_64-linux]
$ ruby test_tracepoint_stat.rb -v
Loaded suite test_tracepoint_stat
Started
TracePointTest:
  test: TracePoint.stat:                                                                                                        F
======================================================================================================================================================
      4:
      5: class TracePointTest < Test::Unit::TestCase
      6:   test 'TracePoint.stat' do
  =>  7:     assert_respond_to(TracePoint, :stat)
      8:   end
      9:
     10:   test 'no TracePoint#stat' do
test_tracepoint_stat.rb:7:in `block in <class:TracePointTest>'
Failure: test: TracePoint.stat(TracePointTest):
  <TracePoint>.respond_to?(:stat) expected
  (Class: <Class>)
======================================================================================================================================================
: (0.005388)
  test: no TracePoint#stat:                                                                                                     F
======================================================================================================================================================
      8:   end
      9:
     10:   test 'no TracePoint#stat' do
  => 11:     assert_not_respond_to(TracePoint.new{}, :stat)
     12:   end
     13: end
test_tracepoint_stat.rb:11:in `block in <class:TracePointTest>'
Failure: test: no TracePoint#stat(TracePointTest):
  !<#<TracePoint:disabled>>.respond_to?(:stat) expected
  (Class: <TracePoint>)
======================================================================================================================================================
: (0.000824)

Finished in 0.006592796 seconds.
------------------------------------------------------------------------------------------------------------------------------------------------------
2 tests, 2 assertions, 2 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
0% passed
------------------------------------------------------------------------------------------------------------------------------------------------------
303.36 tests/s, 303.36 assertions/s

```

Expected Output (Ruby 2.6.4):

```
$ ruby -v
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
$ ruby test_tracepoint_stat.rb -v
Loaded suite test_tracepoint_stat
Started
TracePointTest:
  test: TracePoint.stat:                                                                                                        .: (0.000265)
  test: no TracePoint#stat:                                                                                                     .: (0.000046)

Finished in 0.0006746 seconds.
------------------------------------------------------------------------------------------------------------------------------------------------------
2 tests, 2 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
------------------------------------------------------------------------------------------------------------------------------------------------------
2964.72 tests/s, 2964.72 assertions/s
```




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.