mockparser

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2018 License: MIT Imports: 4 Imported by: 0

README

mockparser.Parser

Very simple mock for basic tests, returns a given collection of links

Documentation

Overview

Package mockparser defines a parser.Interface that returns dummy urls for a given input, and is used in tests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dummy

type Dummy struct {
	Urls []string // List of urls
	Errs []string // List of parse errors as strings
}

Dummy responses

type Parser

type Parser struct {
	Results map[string]Dummy // The results to return: body -> result
}

Parser is a parser.Interface that returns dummy urls for a given input, and is used in tests

func (*Parser) Parse

func (p *Parser) Parse(ctx context.Context, url string, body io.Reader) (urls []string, errs []error)

Parse returns the dummy data if Results contains a matching record.

Jump to

Keyboard shortcuts

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