{"id":18414755,"url":"https://github.com/zoido/errassert","last_synced_at":"2025-06-10T18:37:26.388Z","repository":{"id":230064853,"uuid":"771052537","full_name":"zoido/errassert","owner":"zoido","description":"Simple table driven Go tests error assertions","archived":false,"fork":false,"pushed_at":"2024-11-15T09:12:49.000Z","size":125,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-23T02:50:39.766Z","etag":null,"topics":["assert","assertions","go","golang","table-driven-test","test","testing","testing-tools"],"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/zoido.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-12T15:52:10.000Z","updated_at":"2024-11-15T09:12:52.000Z","dependencies_parsed_at":"2024-03-27T17:26:54.170Z","dependency_job_id":"b494c45e-8e0c-46fa-a334-68de6ea3ca43","html_url":"https://github.com/zoido/errassert","commit_stats":null,"previous_names":["zoido/errassert"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoido%2Ferrassert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoido%2Ferrassert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoido%2Ferrassert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoido%2Ferrassert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zoido","download_url":"https://codeload.github.com/zoido/errassert/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235270183,"owners_count":18963187,"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","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":["assert","assertions","go","golang","table-driven-test","test","testing","testing-tools"],"created_at":"2024-11-06T03:52:15.337Z","updated_at":"2025-01-23T11:24:36.013Z","avatar_url":"https://github.com/zoido.png","language":"Go","readme":"# `errassert`: Simple table driven Go tests error assertions\n\n[![go reference](https://pkg.go.dev/badge/github.com/zoido/errassert)](https://pkg.go.dev/github.com/zoido/errassert)\n[![license](https://img.shields.io/github/license/zoido/errassert?style=flat-square)](https://github.com/zoido/errassert/blob/master/LICENSE)\n![CI](https://img.shields.io/github/actions/workflow/status/zoido/errassert/go.yaml?style=flat-square\u0026logoColor=white\u0026logo=github)\n[![coverage](https://img.shields.io/codecov/c/github/zoido/errassert?style=flat-square\u0026logoColor=white\u0026logo=codecov)](https://codecov.io/gh/zoido/errassert)\n[![go report](https://goreportcard.com/badge/github.com/zoido/errassert?style=flat-square)](https://goreportcard.com/report/github.com/zoido/errassert)\n\n## Overview\n\n- set error assertion in a table driven test declaration\n- provides similar experience as Testify's [`ErrorAssertionFunc`](https://pkg.go.dev/github.com/stretchr/testify/assert#ErrorAssertionFunc)\n- define custom error assertions\n- combine assertions with `errassert.Want`\n- support assertions for gRPC status errors\n\n## Example\n\n\u003c!-- markdownlint-disable MD010 MD013 --\u003e\n\n```go\nfunc Test(t *testing.T) {\n\ttype testCase struct {\n\t\tin        string\n\t\twant      int\n\t\terrassert errassert.ErrorAssertion\n\t}\n\n\trun := func(t *testing.T, tc testCase) {\n\t\t_, err := strconv.Atoi(tc.in)\n\n\t\ttc.errassert.Require(t, err)\n\t}\n\n\ttestCases := map[string]testCase{\n\t\t\"ok\": {\n\t\t\tin:        \"42\",\n\t\t\twant:      42,\n\t\t\terrassert: errassert.NilError(),\n\t\t},\n\t\t\"invalid input fails\": {\n\t\t\tin:        \"invalid input\",\n\t\t\terrassert: errassert.SomeError(),\n\t\t},\n\t\t\"empty input cause invalid syntax error\": {\n\t\t\tin:        \"\",\n\t\t\t// Common basic assertions.\n\t\t\terrassert: errassert.ErrorEndsWith(\"invalid syntax\"),\n\t\t},\n\t\t\"invalid input fails with input\": {\n\t\t\tin: \"input\",\n\t\t\t// Combine basic assertions.\n\t\t\terrassert: errassert.Want(\n\t\t\t\terrassert.ErrorContains(\"\\\"input\\\"\"),\n\t\t\t\terrassert.ErrorEndsWith(\"invalid syntax\"),\n\t\t\t),\n\t\t},\n\t}\n\n\tfor name, tc := range testCases {\n\t\tt.Run(name, func(t *testing.T) { run(t, tc) })\n\t}\n}\n\n\n```\n\u003c!-- markdownlint-enable MD010 MD013 --\u003e\n\n## Credits\n\nBased on experience within [@h2oai](https://github.com/h2oai).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoido%2Ferrassert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzoido%2Ferrassert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoido%2Ferrassert/lists"}