cov

package
v0.0.0-...-e0f7ac1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2020 License: GPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FuncExtent

type FuncExtent struct {
	// contains filtered or unexported fields
}

FuncExtent describes a function's extent in the source by file and position.

type FuncVisitor

type FuncVisitor struct {
	// contains filtered or unexported fields
}

FuncVisitor implements the visitor that builds the function position list for a file.

func (*FuncVisitor) Visit

func (v *FuncVisitor) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface.

type Function

type Function struct {
	// Name is the name of the function. If the function has a receiver, the
	// name will be of the form T.N, where T is the type and N is the name.
	Name string `json:"name"`
	// File is the full path to the file in which the function is defined.
	File string `json:"file"`
	// Start is the start offset of the function's signature.
	Start int `json:"start"`
	// End is the end offset of the function.
	End int `json:"end"`
	// Coverage
	Coverage float64 `json:"coverage"`
	// TLOC
	TLOC int64 `json:"tloc"`
	// Statements registered with this function, JSON output omit statements (for now)
	Statements []*Statement `json:"-"`
}

Function describes a function inner characteristics

func (*Function) Accumulate

func (f *Function) Accumulate(f2 *Function) error

Accumulate will accumulate the coverage information from the provided Function into this Function.

type Package

type Package struct {
	// Name is the package name
	Name string `json:"name"`
	// Path is the canonical path of the package.
	Path string `json:"path"`
	// Coverage
	Coverage float64 `json:"coverage"`
	// LOC contains the number of lines of code for a given package
	LOC int `json:"loc"`
	// Functions is a list of functions registered with this package.
	Functions []*Function `json:"-"`
}

Package describes a package inner characteristics

func (*Package) Accumulate

func (p *Package) Accumulate(p2 *Package) error

Accumulate will accumulate the coverage information from the provided Package into this Package.

type Report

type Report struct {
	// Packages holds all tested packages
	Packages []*Package `json:"packages"`
	// Coverage
	Coverage float64 `json:"coverage"`
}

Report contains information about tested packages, functions and statements

func ConvertRepository

func ConvertRepository(repo string) (*Report, error)

ConvertRepository converts a given repository to a Report struct

type Statement

type Statement struct {
	// Start is the start offset of the statement.
	Start int `json:"start"`
	// End is the end offset of the statement.
	End int `json:"end"`
	// Reached is the number of times the statement was reached.
	Reached int64 `json:"-"`
}

func (*Statement) Accumulate

func (s *Statement) Accumulate(s2 *Statement) error

Accumulate will accumulate the coverage information from the provided Statement into this Statement.

type StmtExtent

type StmtExtent extent

StmtExtent describes a statements's extent in the source by file and position.

type StmtVisitor

type StmtVisitor struct {
	// contains filtered or unexported fields
}

StmtVisitor implements a simple visitor for AST statements

func (*StmtVisitor) VisitStmt

func (v *StmtVisitor) VisitStmt(s ast.Stmt)

VisitStmt lists all statements within a function

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL