All Projects → agiledragon → Gomonkey

agiledragon / Gomonkey

Licence: mit
gomonkey is a library to make monkey patching in unit tests easy

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Gomonkey

purescript-ffi-utils
A utility library for the purescript foreign function interface
Stars: ✭ 22 (-95.35%)
Mutual labels:  interface, function
Shellfuncs
Python API to execute shell functions as they would be Python functions
Stars: ✭ 96 (-79.7%)
Mutual labels:  function, interface
Gojsondiff
Go JSON Diff
Stars: ✭ 371 (-21.56%)
Mutual labels:  patch
Hdiffpatch
a C\C++ library and command-line tools for Diff & Patch between binary files or directories(folder); cross-platform; run fast; create small delta/differential; support large files and limit memory requires when diff & patch.
Stars: ✭ 459 (-2.96%)
Mutual labels:  patch
Promptui
Interactive prompt for command-line applications
Stars: ✭ 4,621 (+876.96%)
Mutual labels:  interface
Ctrlp Funky
A super simple function navigator for ctrlp.vim
Stars: ✭ 373 (-21.14%)
Mutual labels:  function
Scirius
Scirius is a web application for Suricata ruleset management.
Stars: ✭ 435 (-8.03%)
Mutual labels:  interface
C Cpp Notes
Notes about modern C++, C++11, C++14 and C++17, Boost Libraries, ABI, foreign function interface and reference cards.
Stars: ✭ 363 (-23.26%)
Mutual labels:  interface
Unitydarkskin
Switcher of UI theme in Unity Editor (light -> dark) (.NET, WPF)
Stars: ✭ 466 (-1.48%)
Mutual labels:  patch
Tsai
Time series Timeseries Deep Learning Pytorch fastai - State-of-the-art Deep Learning with Time Series and Sequences in Pytorch / fastai
Stars: ✭ 407 (-13.95%)
Mutual labels:  sequence
Sppermissions
Ask permissions with ready-use interface. You can check status permission and if it has been requested before. Support SwiftUI.
Stars: ✭ 4,701 (+893.87%)
Mutual labels:  interface
Nupdate
A comfortable update solution for .NET-applications.
Stars: ✭ 394 (-16.7%)
Mutual labels:  patch
Functional widget
A code generator to write widgets as function without loosing the benefits of classes.
Stars: ✭ 374 (-20.93%)
Mutual labels:  function
Open Stage Control
Libre and modular OSC / MIDI controller
Stars: ✭ 436 (-7.82%)
Mutual labels:  interface
Serving
Kubernetes-based, scale-to-zero, request-driven compute
Stars: ✭ 4,238 (+795.98%)
Mutual labels:  function
Fromfrom
A JS library written in TS to transform sequences of data from format to another
Stars: ✭ 462 (-2.33%)
Mutual labels:  sequence
Jsondiffpatch
Diff & patch JavaScript objects
Stars: ✭ 3,951 (+735.31%)
Mutual labels:  patch
Similar
A high level diffing library for rust based on diffs
Stars: ✭ 386 (-18.39%)
Mutual labels:  patch
Funky
Funky takes shell functions to the next level by making them easier to define, more flexible, and more interactive.
Stars: ✭ 434 (-8.25%)
Mutual labels:  function
Jiekou Python3
接口自动化测试框架——python版,支持HTTP,dubbo协议接口
Stars: ✭ 468 (-1.06%)
Mutual labels:  interface

gomonkey

gomonkey is a library to make monkey patching in unit tests easy.

Features

  • support a patch for a function
  • support a patch for a member method
  • support a patch for a interface
  • support a patch for a function variable
  • support a patch for a global variable
  • support patches of a specified sequence for a function
  • support patches of a specified sequence for a member method
  • support patches of a specified sequence for a interface
  • support patches of a specified sequence for a function variable

Notes

  • gomonkey fails to patch a function or a member method if inlining is enabled, please running your tests with inlining disabled by adding the command line argument that is -gcflags=-l(below go1.10) or -gcflags=all=-l(go1.10 and above).
  • gomonkey should work on any amd64 system.
  • A panic may happen when a goroutine is patching a function or a member method that is visited by another goroutine at the same time. That is to say, gomonkey is not threadsafe.
  • go1.6 version of the reflection mechanism supports the query of private member methods, but go1.7 and above does not support it. However, all versions of the reflection mechanism support the query of private functions, so gomonkey will trigger a panic for only patching a private member method when go1.7 and above is used.

Supported Platform:

  • MAC OS X amd64
  • Linux amd64
  • Windows amd64

Installation

$ go get github.com/agiledragon/gomonkey

Using gomonkey

Please refer to the test cases as idioms, very complete and detailed.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].