test

package
v0.0.0-...-d191b88 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2020 License: BSD-3-Clause, MIT Imports: 10 Imported by: 0

Documentation

Overview

Package test provides utilities for trunnel testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertFileContentsEqual

func AssertFileContentsEqual(t *testing.T, a, b string)

AssertFileContentsEqual asserts that files a and b have the same contents.

func Build

func Build(srcs [][]byte) ([]byte, error)

Build checks whether Go source code src builds correctly. Returns the output of "go build" and an error, if any.

func FileContentsEqual

func FileContentsEqual(a, b string) (bool, error)

FileContentsEqual determines whether a and b have the same contents.

func FileExists

func FileExists(filename string) bool

FileExists tests whether filename exists.

func Glob

func Glob(t *testing.T, pattern string, f func(*testing.T, string))

Glob runs a test on all the files matching a glob pattern.

func LoadFileGroups

func LoadFileGroups(dir string) ([][]string, error)

LoadFileGroups looks for trunnel files in a directory and returns groups of files that can be "compiled" together (accounting for extern struct declarations). Dependencies can be recorded in a deps.yaml file in the directory.

func TempDir

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

TempDir creates a temp directory. Returns the path to the directory and a cleanup function.

func TrunnelFiles

func TrunnelFiles(dir string) ([]string, error)

TrunnelFiles returns all the trunnel files in the given directory.

Types

type Dependencies

type Dependencies struct {
	Dependencies map[string][]string
}

Dependencies records dependencies between trunnel files.

func LoadDependenciesDir

func LoadDependenciesDir(dir string) (*Dependencies, error)

LoadDependenciesDir looks for "deps.yml" in the directory and loads it if it exists. If the file is not found, it loads an empty set of dependencies.

func LoadDependenciesFile

func LoadDependenciesFile(filename string) (*Dependencies, error)

LoadDependenciesFile loads Dependencies from a YAML file.

Jump to

Keyboard shortcuts

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