testutility

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package testutility is a package for capturing output for testing.

Index

Constants

View Source
const (
	// TEST_OUTPUT_STDOUT is a constant for stdout
	TEST_OUTPUT_ANY = "ANY"
)

Variables

This section is empty.

Functions

func RemoveTabAndSpaceAndLf

func RemoveTabAndSpaceAndLf(input string) string

RemoveTabAndSpaceAndLf removes tab, space, and line feed

func ReplaceDoubleSlashToSingleSlash

func ReplaceDoubleSlashToSingleSlash(input string) string

ReplaceDoubleSlashToSingleSlash replaces double slash to single slash

Types

type Capturable

type Capturable interface {
	CaptureOutput() (string, string, error)
}

Capturable is an interface for capturing output.

type Capturer

type Capturer struct {
	OutBuffer bufferproxy.Buffer
	ErrBuffer bufferproxy.Buffer
	OsProxy   osproxy.Os
}

Capturer is a struct for capturing output.

func NewCapturer

func NewCapturer(
	outBuffer bufferproxy.Buffer,
	errBuffer bufferproxy.Buffer,
	osProxy osproxy.Os,
) *Capturer

NewCapturer is a constructor for Capturer.

func (*Capturer) CaptureOutput

func (c *Capturer) CaptureOutput(t *testing.T, fnc func()) (string, string, error)

CaptureOutput captures the output of the function and returns the captured.

type JrpChecker

type JrpChecker struct {
	FmtProxy     fmtproxy.Fmt
	SortProxy    sortproxy.Sort
	SqlProxy     sqlproxy.Sql
	StrconvProxy strconvproxy.Strconv
	StringsProxy stringsproxy.Strings
}

JrpChecker is a struct for checking Jrp.

func NewJrpChecker

func NewJrpChecker(
	fmtProxy fmtproxy.Fmt,
	sortProxy sortproxy.Sort,
	sqlProxy sqlproxy.Sql,
	strconvProxy strconvproxy.Strconv,
	stringsProxy stringsproxy.Strings,
) *JrpChecker

NewJrpChecker is a constructor for JrpChecker.

func (*JrpChecker) GetJrpSeq

func (j *JrpChecker) GetJrpSeq(jrpDBFilePath string) (int, error)

GetJrpSeq returns the sequence of jrp.

func (*JrpChecker) IsExist

func (j *JrpChecker) IsExist(jrpDBFilePath string, id int) (bool, error)

IsExist checks if jrp exists.

func (*JrpChecker) IsFavorited

func (j *JrpChecker) IsFavorited(jrpDBFilePath string, id int) (bool, error)

IsFavorited checks if jrp is favorited.

func (*JrpChecker) IsSameJrps

func (j *JrpChecker) IsSameJrps(got, want []*model.Jrp) bool

IsSameJrps checks if jrps are the same.

type JrpCheckerInterface

type JrpCheckerInterface interface {
	GetJrpSeq(jrpDBFilePath string) (int, error)
	IsExist(jrpDBFilePath string, id int) (bool, error)
	IsFavorited(jrpDBFilePath string, id int) (bool, error)
	IsSameJrps(got, want []*model.Jrp) bool
}

JrpCheckerInterface is an interface for checking Jrp.

Jump to

Keyboard shortcuts

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