testing

package
v0.0.0-...-4f8c79a Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2015 License: BSD-3-Clause Imports: 10 Imported by: 0

README

Testing utilities

This package contains a set of simple testing utilities for use with the gocheck package.

TODOS

  • Add tests for these.

Documentation

Overview

This provides various testing utilities that are compatible with the gocheck package.

Index

Constants

This section is empty.

Variables

View Source
var DirectoryMatches = &directoryMatcher{
	&CheckerInfo{Name: "DirectoryMatches", Params: []string{"obtained", "expected"}},
}
View Source
var ErrorIsNil Checker = &errorIsNilChecker{
	&CheckerInfo{Name: "ErrorIsNil", Params: []string{"value"}},
}

The IsNil checker tests whether the obtained value is nil.

For example:

c.Assert(err, IsNil)
View Source
var FileMatches = &fileMatcher{
	&CheckerInfo{Name: "FileMatches", Params: []string{"obtained", "expected"}},
}
View Source
var HasFilesNamed = &directoryContains{
	&CheckerInfo{Name: "HasFilesNamed", Params: []string{"obtained", "expected"}},
}
View Source
var NilOrErrorMatches = &nilErrorMatcher{
	&CheckerInfo{Name: "NilOrErrorMatches", Params: []string{"obtained", "regex"}},
}

Functions

func CreateTestFile

func CreateTestFile(c *C, fileName string, contents []byte, perm os.FileMode) string

This creates a file named fileName in a temporary directory specifically created for this file. The contents are then written to the file. This file will be deleted at the end of a test. If creation of the file fails, the test will be aborted. The method will return the full path to the created file.

func UnsafeUnixCopyTree

func UnsafeUnixCopyTree(src, dest string) (err error)

Function to copy a directory tree in UNIX-ey OSes. This just runs cp -r

func WaitForSyncGroup

func WaitForSyncGroup(wg *sync.WaitGroup, d time.Duration) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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