Sha256: 0057d7489ad66f063f2754aa43ef600277097d9b0d815d88b9e725c59cd65978

Contents?: true

Size: 771 Bytes

Versions: 13

Compression:

Stored size: 771 Bytes

Contents

# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2022-2023, by Samuel Williams.

def initialize(context)
	super
	
	require_relative '../../lib/covered'
end

# Debug the coverage of a file. Show which lines should be executable.
#
# @parameter paths [Array(String)] The paths to parse.
# @parameter execute [Boolean] Whether to execute the code.
def parse(paths: [], execute: false)
	files = output = Covered::Files.new
	output = Covered::Source.new(output)
	
	paths.each do |path|
		output.mark(path, 0, 0)
	end
	
	if execute
		capture = Covered::Capture.new(output)
		capture.start
		paths.each do |path|
			load path
		end
		capture.finish
		
		files.paths = files.paths.slice(*paths)
	end
	
	Covered::Summary.new.call(output, $stderr)
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
covered-0.25.1 bake/covered/debug.rb
covered-0.25.0 bake/covered/debug.rb
covered-0.24.3 bake/covered/debug.rb
covered-0.24.2 bake/covered/debug.rb
covered-0.24.1 bake/covered/debug.rb
covered-0.24.0 bake/covered/debug.rb
covered-0.23.0 bake/covered/debug.rb
covered-0.22.1 bake/covered/debug.rb
covered-0.22.0 bake/covered/debug.rb
covered-0.21.0 bake/covered/debug.rb
covered-0.20.2 bake/covered/debug.rb
covered-0.20.1 bake/covered/debug.rb
covered-0.20.0 bake/covered/debug.rb