Skip to content

fgrosse/gomega-matchers

Repository files navigation

GoDoc

A set of custom gomega matchers to test generated go code.

Example of included new matchers:

myCode := `
	package main

	import "fmt"

	func main() {
		fmt.Println("Hello, 世界")
	}
`

Expect(myCode).To(BeValidGoCode())
Expect(myCode).To(DeclarePackage("main"))
Expect(myCode).To(ImportPackage("fmt"))
Expect(myCode).To(ContainCode(`fmt.Println("Hello, 世界")`))
Expect("2006-01-02T15:04").To(EqualTime(time.Now()))

These matchers are actively used in the goldi test suit.