parser

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package parser defines the Parser interface and the global registry used for format auto-detection and dispatch.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseFile

func ParseFile(path string, p Parser) (*model.Report, error)

ParseFile opens path and parses it using p. If p is nil, the format is auto-detected from the file extension and content. Pass "-" as path to read from stdin; content detection is used in that case.

func Register

func Register(p Parser)

Register adds p to the global registry. Parsers registered earlier take precedence during auto-detection.

Types

type Parser

type Parser interface {
	// Name is the canonical format identifier, lowercase, no spaces.
	Name() string
	// Extensions lists file extensions (without leading dot) this parser handles.
	Extensions() []string
	// Detect returns true if the given header bytes look like this format.
	// header is at most 512 bytes from the beginning of the file.
	Detect(header []byte) bool
	// Parse reads r to completion and returns a normalised Report.
	Parse(r io.Reader, source string) (*model.Report, error)
}

Parser converts a specific test result format into a model.Report.

func ForName

func ForName(name string) (Parser, error)

ForName returns the parser registered under name or one of its known aliases.

Directories

Path Synopsis
Package cucumber parses Cucumber JSON test result files.
Package cucumber parses Cucumber JSON test result files.
Package gotest parses the streaming JSON output produced by `go test -json`.
Package gotest parses the streaming JSON output produced by `go test -json`.
Package junit implements a streaming JUnit XML parser that also handles Google Test XML output (a compatible superset with optional file/line attrs).
Package junit implements a streaming JUnit XML parser that also handles Google Test XML output (a compatible superset with optional file/line attrs).
Package nunit parses NUnit 2/3 and xUnit .NET XML test result files.
Package nunit parses NUnit 2/3 and xUnit .NET XML test result files.
Package tap parses TAP (Test Anything Protocol) streams, versions 12 and 13.
Package tap parses TAP (Test Anything Protocol) streams, versions 12 and 13.

Jump to

Keyboard shortcuts

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