1 Feb 2010 01:02
Re: [ANN] Blog post about gospecify
On Feb 1, 1:38 am, Tom Lieber <all...@...> wrote: > "expected X == Y" and "expected X > Y" Thanks for the inspiration! I think I just figured out a new syntax, which would be more terse and even more expressive: c.Expect(answer, Equals, 42) c.Expect(answer, Not(Equals), 666) The definitions of those methods are in pseudo-Go: func (c *Context) Expect(actual interface{}, m Matcher, expected interface{}) {...} type Matcher func(actual interface{}, expected interface{}) bool func Equals(actual interface{}, expected interface{}) bool {...} func Not(m Matcher) Matcher {...} This will require one to import the Equals etc. functions to the current namespace (prefixing them with the package name would be verbose), but I suppose it is acceptable in test code.
.
-Brett
RSS Feed