From: deivid.rodriguez@... Date: 2020-04-18T14:31:12+00:00 Subject: [ruby-core:97951] [Ruby master Bug#16776] Regression in coverage library Issue #16776 has been updated by deivid (David Rodr�guez). marcandre (Marc-Andre Lafortune) wrote in #note-3: > I never realized this limitation. I imagine that for the vast majority of users it's a non issue, but for `byebug` it is quite serious. Would you consider using `deep-cover` instead? It sounds like the plan is to fix this one way or another, so I'll wait for now. But thanks for pointing me to deep-cover, it sounds interesting! ---------------------------------------- Bug #16776: Regression in coverage library https://bugs.ruby-lang.org/issues/16776#change-85177 * Author: deivid (David Rodr�guez) * Status: Open * Priority: Normal * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- Hi! I noticed a regression in the coverage library. I tried to write a minimal program to show it, hopefully it gives some clues or where the issue might lie. In ruby 2.5.8 and earlier, the following program would print `{:lines=>[1, 1, nil]}`, showing that the body of the "foo" method was run once. However, on newer rubies, it prints `{:lines=>[1, 0, nil]}`, which is incorrect because the "foo" method body has actually been run once. This is the repro script: ```ruby # frozen_string_literal: true require "coverage" Coverage.start(lines: true) code = <<~RUBY def foo "LOL" end RUBY File.open("foo.rb", "w") { |f| f.write(code) } require_relative "foo" TracePoint.new(:line) do |_tp| foo end.enable do sleep 0 end res = Coverage.result puts res[File.expand_path("foo.rb")] ``` -- https://bugs.ruby-lang.org/ Unsubscribe: