utests

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package utests defines util fns for Scorecard unit testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateLogMessage

func ValidateLogMessage(isExpectedMessage func(checker.LogMessage, checker.DetailType) bool,
	dl *TestDetailLogger) bool

ValidateLogMessage tests that at least one log message returns true for isExpectedMessage.

func ValidateLogMessageOffsets

func ValidateLogMessageOffsets(dl *TestDetailLogger, offsets []int) bool

ValidateLogMessageOffsets tests that the log message offsets match those in the passed in slice.

func ValidateTestReturn

func ValidateTestReturn(t *testing.T, name string, expected *TestReturn,
	actual *checker.CheckResult, logger *TestDetailLogger) bool

ValidateTestReturn validates expected TestReturn with actual checker.CheckResult values. nolint: thelper

Types

type TestDetailLogger

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

TestDetailLogger implements `checker.DetailLogger`.

func (*TestDetailLogger) Debug

func (l *TestDetailLogger) Debug(desc string, args ...interface{})

Debug implements DetailLogger.Debug.

func (*TestDetailLogger) Debug3

func (l *TestDetailLogger) Debug3(msg *checker.LogMessage)

Debug3 implements DetailLogger.Debug3.

func (*TestDetailLogger) Info

func (l *TestDetailLogger) Info(desc string, args ...interface{})

Info implements DetailLogger.Info.

func (*TestDetailLogger) Info3

func (l *TestDetailLogger) Info3(msg *checker.LogMessage)

Info3 implements DetailLogger.Info3.

func (*TestDetailLogger) Warn

func (l *TestDetailLogger) Warn(desc string, args ...interface{})

Warn implements DetailLogger.Warn.

func (*TestDetailLogger) Warn3

func (l *TestDetailLogger) Warn3(msg *checker.LogMessage)

Warn3 implements DetailLogger.Warn3.

type TestReturn

type TestReturn struct {
	Error         error
	Score         int
	NumberOfWarn  int
	NumberOfInfo  int
	NumberOfDebug int
}

TestReturn encapsulates expected CheckResult return values.

Jump to

Keyboard shortcuts

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