Documentation ¶
Overview ¶
Example ¶
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()))
Output:
Index ¶
- func BeValidGoCode() types.GomegaMatcher
- func ContainCode(expected string) types.GomegaMatcher
- func DeclarePackage(packageName string) types.GomegaMatcher
- func Dump(output *bytes.Buffer)
- func EqualTime(expected interface{}) types.GomegaMatcher
- func ImportPackage(expected string) types.GomegaMatcher
- func RegisterExtendedTestingT(t types.GomegaTestingT)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BeValidGoCode ¶
func BeValidGoCode() types.GomegaMatcher
BeValidGoCode succeeds if actual can be converted or read into to byte[] and contains valid go code.
func ContainCode ¶
func ContainCode(expected string) types.GomegaMatcher
ContainCode succeeds if actual can be converted or read into to byte[], is valid go code and contains the given go code. Indentation is ignored and the syntax of the given go code is not checked.
func DeclarePackage ¶
func DeclarePackage(packageName string) types.GomegaMatcher
DeclarePackage succeeds if actual can be converted or read into to byte[], is valid go code and declares the given package name.
func EqualTime ¶
func EqualTime(expected interface{}) types.GomegaMatcher
EqualTime succeeds if actual is a time.Time or a RFC3339 formatted string and equals expected. expected can either be a time.Time or a string in RFC3339.
func ImportPackage ¶
func ImportPackage(expected string) types.GomegaMatcher
ImportPackage succeeds if actual can be converted or read into to byte[], is valid go code and contains an import statement for the given package
func RegisterExtendedTestingT ¶
func RegisterExtendedTestingT(t types.GomegaTestingT)
RegisterExtendedTestingT is like gomega.RegisterTestingT but it also omits any gomega frames from the printed stacktrace.
Types ¶
This section is empty.