monkey

package module
v0.0.0-...-276cb13 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: MIT Imports: 6 Imported by: 0

README

monkey

monkey is a library to make patch for unit tests, this repository modified some from gomonkey.

original

https://github.com/bouk/monkey
https://github.com/agiledragon/gomonkey

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PatchGuard

type PatchGuard struct {
	// contains filtered or unexported fields
}

PatchGuard contains original and patch data for unpatch.

func Patch

func Patch(target, patch interface{}) *PatchGuard

Patch is used to patch common function.

func PatchMethod

func PatchMethod(target interface{}, method string, patch interface{}) *PatchGuard

PatchMethod is used to patch structure methods, it supports private methods and private structure public and private methods, usually the private structure is from interface.

func (*PatchGuard) Restore

func (pg *PatchGuard) Restore()

Restore is used to patch the target again.

func (*PatchGuard) Unpatch

func (pg *PatchGuard) Unpatch()

Unpatch is used to recovery the original about target.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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