mytest

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 6 Imported by: 1

README

Go Reference Go Report Card

mytest

Go testing utilities with a focus on table driven tests.

Documentation

Overview

package mytest provides testing utilities for long, repetitive, table driven tests.

Index

Constants

View Source
const (
	// ANSI color codes for text color
	RED    = "\x1b[31m"
	GREEN  = "\x1b[32m"
	BLUE   = "\x1b[34m"
	YELLOW = "\x1b[33m"
	CYAN   = "\x1b[36m"

	RESET = "\x1b[0m"
)

ANSI color codes for text color

View Source
const VERSION = "1.0.1"

Variables

View Source
var DISPLAY_WINDOW = 160

max number of characters to display, before and after first discrepency detected. adjusting this value has no effect on stored files, only on displayed messages.

Functions

func Verify

func Verify(t *testing.T, content string, reference string)

Verify provided content against reference file. If no reference file found, create it. A .want extension and a _ prefix are added to the reference filename base name, and path is removed to force storage in local source folder. If content differs from existing reference file, create a xxx.got file for further review and fail the test.

func VerifyFile

func VerifyFile(t *testing.T, pathToFile string)

Apply Verify to the content of the specified file. Not suitable for large files, because file will be loaded entirely in memory.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳