parsers

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractScenarioTitleFromAst

func ExtractScenarioTitleFromAst(node ast.Node, source []byte) (string, error)

Assumes the title of the scenario is the first h1 header in the markdown file.

func ExtractScenarioVariablesFromAst

func ExtractScenarioVariablesFromAst(node ast.Node, source []byte) map[string]string

Extracts the variables from a provided markdown AST.

func ExtractYamlMetadataFromAst added in v0.1.2

func ExtractYamlMetadataFromAst(node ast.Node) map[string]interface{}

func ParseINIFile

func ParseINIFile(filePath string) (map[string]string, error)

Parses an INI file into a flat map of keys mapped to values. This reduces the complexity of the INI file to a simple key/value store and ignores the sections.

func ParseMarkdownIntoAst

func ParseMarkdownIntoAst(source []byte) ast.Node

Parses a markdown file into an AST representing the markdown document.

Types

type CodeBlock

type CodeBlock struct {
	Language       string
	Content        string
	Header         string
	Description    string
	ExpectedOutput ExpectedOutputBlock
}

The representation of a code block in a markdown file.

func ExtractCodeBlocksFromAst

func ExtractCodeBlocksFromAst(
	node ast.Node,
	source []byte,
	languagesToExtract []string,
) []CodeBlock

Extracts the code blocks from a provided markdown AST that match the languagesToExtract.

type ExpectedOutputBlock

type ExpectedOutputBlock struct {
	Language           string
	Content            string
	ExpectedSimilarity float64
	ExpectedRegex      *regexp.Regexp
}

The representation of an expected output block in a markdown file. This is for scenarios that have expected output that should be validated against the actual output.

Jump to

Keyboard shortcuts

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