gomodtest

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package gomodtest includes helpers for accessing files and packages inside the current Go Module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandPackage

func ExpandPackage(t *testing.T, path string) string

ExpandPackage expands the package name inside tests.

func ExpandPath

func ExpandPath(t *testing.T, path string) string

ExpandPath expands the package path inside tests.

func ReadFile

func ReadFile(t *testing.T, path string) []byte

ReadFile reads from the given path data and returns it.

func ReadFileJSON

func ReadFileJSON(t *testing.T, path string, data interface{})

ReadFileJSON reads from the given path data into the given interface. Fails fatally if reading the file or unmarshalling into the given data structure fails.

func WriteFile

func WriteFile(t *testing.T, path string, data []byte)

WriteFile writes the given data to the given path, which is being expanded based on the current Go Module.

func WriteFileJSON

func WriteFileJSON(t *testing.T, path string, data interface{})

WriteFileJSON writes the given data as JSON to the given path, which is being expanded based on the current Go Module.

Types

This section is empty.

Jump to

Keyboard shortcuts

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