package
0.2.3
Repository: https://github.com/yoanm/go-tfsig.git
Documentation: pkg.go.dev

# README

testutils

Functions

func EnsureBlockFileEqualsGoldenFile

func EnsureBlockFileEqualsGoldenFile(block *hclwrite.Block, goldenFile string) error

EnsureBlockFileEqualsGoldenFile checks that provided hclwrite.Block content is equals to the content of the provided golden file.

func EnsureFileContentEquals

func EnsureFileContentEquals(file *hclwrite.File, expected string) error

EnsureFileContentEquals checks that provided hclwrite.File content is equals to the expected string.

func EnsureFileEqualsGoldenFile

func EnsureFileEqualsGoldenFile(file *hclwrite.File, goldenFile string) error

EnsureFileEqualsGoldenFile checks that provided hclwrite.File content is equals to the content of the provided golden file.

func ExpectPanic

func ExpectPanic(t *testing.T, tcname string, callback func(), expectedError string)

ExpectPanic executes provided 'fn' function and check that:

  • panic(...) has been called
  • related error is the expected one.

func LoadGoldenFile

func LoadGoldenFile(filename string) (*string, error)

LoadGoldenFile loads the golden file filename located under 'testdata' directory

It takes care of suffixing the filename with ".golden.tf".

Types

type ExpectedMismatchError

type ExpectedMismatchError struct { ... }

ExpectedMismatchError is an error wrapping expected and actual value when they don't match.

func (ExpectedMismatchError) Error

func (e ExpectedMismatchError) Error() string

Error is a basic implementation of error interface, it returns a formatted error message.


Readme created from Go doc with goreadme

# Functions

EnsureBlockFileEqualsGoldenFile checks that provided `hclwrite.Block` content is equals to the content of the provided golden file.
EnsureFileContentEquals checks that provided `hclwrite.File` content is equals to the expected string.
EnsureFileEqualsGoldenFile checks that provided `hclwrite.File` content is equals to the content of the provided golden file.
ExpectPanic executes provided 'fn' function and check that: - `panic(...)` has been called - related error is the expected one.
LoadGoldenFile loads the golden file filename located under 'testdata' directory It takes care of suffixing the filename with ".golden.tf".

# Structs

ExpectedMismatchError is an error wrapping expected and actual value when they don't match.