gomodtest

package
v0.2.18 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2020 License: MIT Imports: 5 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 ExpandFilepath added in v0.2.13

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

ExpandPath expands the package path inside tests.

func ExpandPackage

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

ExpandPackage expands the package name 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