testutil

package
v0.0.0-...-2ee2aa9 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package testutil contains helpers to simplify tests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStringValue

func NewStringValue(v string) pflag.Value

NewStringValue creates a new StringValue Flag

func TempDir

func TempDir(t *testing.T) (out string, cleanup func())

TempDir creates a temp dir and returns a cleanup method

func TempFile

func TempFile(t *testing.T) (out *os.File, cleanup func())

TempFile creates a temp file and returns a cleanup method

func TestdataPath

func TestdataPath(t *testing.T) string

TestdataPath returns the absolute path to the testdata directory

func UnTar

func UnTar(t *testing.T, repoName RepoName) (repoPath string, cleanup func())

UnTar will untar a git repository in a new temporary folder.

Types

type RepoName

type RepoName string

RepoName represent the name of a test repository

const (
	// RepoSmall is a snapshot of this repo up to commit bbb720a
	// from Fri Jun 19 18:16:17 2020 -0700
	RepoSmall RepoName = "small_repo"
)

type StringValue

type StringValue struct {
	Value string
}

StringValue represents a Flag value to be parsed by spf13/pflag

func (*StringValue) Set

func (v *StringValue) Set(value string) (err error)

Set sets the flag's value. When called multiple times: - If the value is a relative path it will be append to the previous value - If the value is an absolute path: it will overwrite the previous value

func (*StringValue) String

func (v *StringValue) String() string

String returns the flag's value

func (*StringValue) Type

func (v *StringValue) Type() string

Type returns the unique type of the Value

Directories

Path Synopsis
Package confutil contains helpers and function to generate basic configuration
Package confutil contains helpers and function to generate basic configuration
Package exe contains helpers to help running commands
Package exe contains helpers to help running commands

Jump to

Keyboard shortcuts

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