{"id":21725164,"url":"https://github.com/garvincasimir/gomockext","last_synced_at":"2025-10-08T19:32:49.868Z","repository":{"id":56855442,"uuid":"525569803","full_name":"garvincasimir/gomockext","owner":"garvincasimir","description":"Utilities intended to make testing with gomock simpler","archived":false,"fork":false,"pushed_at":"2022-08-17T21:45:02.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T21:38:54.260Z","etag":null,"topics":["custom-matcher","extension","go","golang","gomock","matcher","testing"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/garvincasimir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-16T23:11:02.000Z","updated_at":"2022-08-18T13:31:31.000Z","dependencies_parsed_at":"2022-09-22T14:24:49.011Z","dependency_job_id":null,"html_url":"https://github.com/garvincasimir/gomockext","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/garvincasimir/gomockext","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garvincasimir%2Fgomockext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garvincasimir%2Fgomockext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garvincasimir%2Fgomockext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garvincasimir%2Fgomockext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/garvincasimir","download_url":"https://codeload.github.com/garvincasimir/gomockext/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garvincasimir%2Fgomockext/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000703,"owners_count":26082805,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["custom-matcher","extension","go","golang","gomock","matcher","testing"],"created_at":"2024-11-26T03:15:49.011Z","updated_at":"2025-10-08T19:32:49.839Z","avatar_url":"https://github.com/garvincasimir.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gomockext\ngomockext is a library which adds extensions useful for simplifying testing using [gomock](https://github.com/golang/mock)\n\n## Installation\n\n\nTo get the latest released version use:\n\n### Go 1.18+\n\n```bash\ngo get github.com/garvincasimir/gomockext@v1.0.0\n```\n## Usage\n\n### Custom Matcher\nYou can create a custom matcher to meet more specific conditions by calling the `gomockext.Match` function. \n\n```go\n// StartsWith returns a matcher which checks if a string starts with a specific prefix\nfunc StartsWith(prefix, message string) mockext.CustomMatcher {\n\treturn mockext.Match(func(got any) bool {\n\t\tif str, ok := got.(string); ok {\n\t\t\treturn strings.HasPrefix(str, prefix)\n\t\t}\n\t\treturn false\n\t}, message)\n}\n\nfunc TestArg1StringStartsWith(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tfooBar := NewMockFooBar(ctrl)\n\n\tfooBar.EXPECT().WithString(StartsWith(\"Foo\", \"Arg should start with Foo\")).Times(1)\n\tfooBar.WithString(\"FooBar\")\n}\n```\n\n### Built-In Matcher\nThe library comes with several built in matchers. Please take a look at the [examples](https://github.com/garvincasimir/gomockext/tree/main/example) folder for usage examples. \n\n```go\n// StartsWith returns a matcher which checks if a string starts with a specific prefix\nfunc TestArg1StringStartsWith(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tfooBar := NewMockFooBar(ctrl)\n\n\tfooBar.EXPECT().WithString(stringext.StartsWith(\"Foo\", \"Arg should start with Foo\")).Times(1)\n\tfooBar.WithString(\"FooBar\")\n}\n```\n\n## Contributing\nPlease feel free to submit bugs, pull requests and suggestions for improving the library. The repo is configured to create a custom [Codespace](https://github.com/features/codespaces) with everything you need to start contributing","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarvincasimir%2Fgomockext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgarvincasimir%2Fgomockext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarvincasimir%2Fgomockext/lists"}