Skip to content

Commit 7e8b4ac

Browse files
mtortonesiandrykonchin
authored andcommitted
Update Coverage for Ruby 3.2 interface changes.
1 parent 2e95271 commit 7e8b4ac

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/truffle/coverage.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,23 @@
1111

1212
module Coverage
1313

14-
def self.start
14+
def self.supported?(mode)
15+
mode == :lines
16+
end
17+
18+
def self.start(*arguments, **options)
19+
# We have to track if the :lines option was provided, as that calls for a
20+
# different result format
21+
@lines = true if options[:lines]
1522
Truffle::Coverage.enable
1623
end
1724

1825
def self.result
1926
result = peek_result
2027
Truffle::Coverage.disable
28+
# We have to wrap the coverage lines array in a hash with the :lines key if
29+
# the :lines option was given
30+
result.transform_values! { |_,lines_array| {lines: lines_array} } if @lines
2131
result
2232
end
2333

0 commit comments

Comments
 (0)