testutil

package module
v0.0.0-...-3d84a2e Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: MIT-0 Imports: 5 Imported by: 0

README

Unit Test Utility Functions

This module is used solely to support the unit testing of other modules. As such, this module lacks unit testing of its own - the he code here is exercised by the unit tests of other modules.

Functions

CaptureLogging(f func())

CaptureLogging allows unit tests to override the default Zap logger to capture the logging output that results from execution of the supplied function. The captured log output is returned as a string after the default logger has been restored.

The supplied function parameter would typically be an inline function supplied by a unit test that needs to evaluate the log output of some test subject to determine if the test passed or failed.

Documentation

Overview

Package testutil provides assorted utility functions to support unit testing that can be reused across the poc-gcp-ecomm project and other projects beyond that.

As a package used for unit testing, this module does not have any unit tests of its own. The code here is exercised by the unit tests of other modules.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureLogging

func CaptureLogging(f func()) string

CaptureLogging allows unit tests to override the default Zap logger to capture the logging output that results from execution of the supplied function. The captured log output is returned as a string after the default logger has been restored.

The supplied function parameter would typically be an inline function supplied by a unit test that needs to evaluate the log output of some test subject to determine if the test passed or failed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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