Skip to content
A set of matchers for Go inspired by Google Test for C++ and Google JS Test.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Updated gitignore file. Dec 18, 2011
.travis.yml Enabled Travis CI. Jul 20, 2015
LICENSE Added a license file. Dec 16, 2011
README.md Modernized callouts to documentation. Feb 16, 2015
all_of.go Updated several matchers. Jan 29, 2012
all_of_test.go Fixed banner lengths. Sep 30, 2012
any.go Updated several matchers. Jan 29, 2012
any_of.go Fixed AnyOf for nil input. Mar 20, 2015
any_of_test.go Fixed AnyOf for nil input. Mar 20, 2015
any_test.go Fixed banner lengths. Sep 30, 2012
contains.go Implemented Contains. Oct 1, 2012
contains_test.go Fixed description tests. Oct 1, 2012
deep_equals.go
deep_equals_test.go Fixed up errors messages for nil slices. Aug 30, 2012
elements_are.go Updated several matchers. Jan 29, 2012
elements_are_test.go Fixed banner lengths. Sep 30, 2012
equals.go Classify uintptr correctly. Jul 16, 2015
equals_test.go Fixed more tests. Jul 16, 2015
error.go Finished fixing up matchers. Jan 29, 2012
error_test.go Fixed banner lengths. Sep 30, 2012
greater_or_equal.go Implemented GreaterOrEqual, for #14. Dec 22, 2011
greater_or_equal_test.go Fixed GreaterOrEqualTest. Jul 16, 2015
greater_than.go Implemented GreaterThan, for #13. Dec 22, 2011
greater_than_test.go Fixed GreaterThanTest. Jul 16, 2015
has_same_type_as.go Implemented HasSameTypeAs. Mar 11, 2015
has_same_type_as_test.go HasSameTypeAsTest.CandidateIsStringAlias Mar 11, 2015
has_substr.go Use NewMatcher for HasSubstr. Mar 11, 2015
has_substr_test.go Fixed banner lengths. Sep 30, 2012
identical_to.go Fixed a broken comment. Aug 29, 2012
identical_to_test.go Fixed a test bug in go 1.1. May 20, 2013
less_or_equal.go Fixed description bug, for #15. Dec 22, 2011
less_or_equal_test.go
less_than.go Finished fixing up matchers. Jan 29, 2012
less_than_test.go Fixed more tests. Jul 16, 2015
matcher.go Added a callout to NewMatcher from type Matcher. Mar 11, 2015
matches_regexp.go Fixed a typo. Feb 11, 2015
matches_regexp_test.go Fixed banner lengths. Sep 30, 2012
new_matcher.go Implemented NewMatcher. Mar 11, 2015
not.go Finished fixing up matchers. Jan 29, 2012
not_test.go Fixed banner lengths. Sep 30, 2012
panics.go Finished fixing up matchers. Jan 29, 2012
panics_test.go Fixed banner lengths. Sep 30, 2012
pointee.go
pointee_test.go Improved error messages from Pointee. Aug 31, 2012
transform_description.go Finished fixing up matchers. Jan 29, 2012

README.md

GoDoc

oglematchers is a package for the Go programming language containing a set of matchers, useful in a testing or mocking framework, inspired by and mostly compatible with Google Test for C++ and Google JS Test. The package is used by the ogletest testing framework and oglemock mocking framework, which may be more directly useful to you, but can be generically used elsewhere as well.

A "matcher" is simply an object with a Matches method defining a set of golang values matched by the matcher, and a Description method describing that set. For example, here are some matchers:

// Numbers
Equals(17.13)
LessThan(19)

// Strings
Equals("taco")
HasSubstr("burrito")
MatchesRegex("t.*o")

// Combining matchers
AnyOf(LessThan(17), GreaterThan(19))

There are lots more; see here for a reference. You can also add your own simply by implementing the oglematchers.Matcher interface.

Installation

First, make sure you have installed Go 1.0.2 or newer. See here for instructions.

Use the following command to install oglematchers and keep it up to date:

go get -u github.com/jacobsa/oglematchers

Documentation

See here for documentation. Alternatively, you can install the package and then use godoc:

godoc github.com/jacobsa/oglematchers
You can’t perform that action at this time.