项目作者: enocom

项目描述 :
fm is short for fang-mao 仿冒 and generates spies of interfaces in Go
高级语言: Go
项目地址: git://github.com/enocom/fm.git
创建时间: 2016-12-29T19:15:15Z
项目社区:https://github.com/enocom/fm

开源协议:The Unlicense

下载


fm Build Status Go Report Card GoDoc

The letters fm are short for the Chinese word fangmao 仿冒, which literally means “to imitate and obscure”, or “counterfeit.” It is also a tool written in Go for generating spy implementations of interfaces.

Note: the use of the word “spy” is deliberate. See here for more.

Background

Writing a spy generator is the “Hello, World!” of AST parsing and generating in Go. There are many full featured libraries that do the same thing and better. For example, see Counterfeiter, Hel, or GoMock. The code here represents my own minimalist approach to the problem of generating test doubles. Generally, I prefer writing spies by hand, which makes for simpler tests and one less dependency to manage. Less is more.

TODO

  • support embedded interfaces