{"id":16766126,"url":"https://github.com/akshayjshah/attest","last_synced_at":"2025-06-12T23:03:31.846Z","repository":{"id":41839426,"uuid":"472106150","full_name":"akshayjshah/attest","owner":"akshayjshah","description":"Type-safe assertion helpers for Go","archived":false,"fork":false,"pushed_at":"2024-08-09T05:03:56.000Z","size":39,"stargazers_count":16,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-02T02:38:30.156Z","etag":null,"topics":["assert","generics","go","testing"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/go.akshayshah.org/attest","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/akshayjshah.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","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":"2022-03-20T21:22:57.000Z","updated_at":"2025-03-29T23:16:19.000Z","dependencies_parsed_at":"2023-12-07T06:25:40.233Z","dependency_job_id":"f35e277f-cba7-4528-b7a4-50ee482d4f4c","html_url":"https://github.com/akshayjshah/attest","commit_stats":{"total_commits":43,"total_committers":4,"mean_commits":10.75,"dds":0.2790697674418605,"last_synced_commit":"51c4d68067c3933aa758e0a0584ad939e6cec469"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/akshayjshah/attest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshayjshah%2Fattest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshayjshah%2Fattest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshayjshah%2Fattest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshayjshah%2Fattest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akshayjshah","download_url":"https://codeload.github.com/akshayjshah/attest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshayjshah%2Fattest/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259546413,"owners_count":22874560,"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","generics","go","testing"],"created_at":"2024-10-13T06:05:28.469Z","updated_at":"2025-06-12T23:03:31.797Z","avatar_url":"https://github.com/akshayjshah.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"attest\n======\n\n[![Build](https://github.com/akshayjshah/attest/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/akshayjshah/attest/actions/workflows/ci.yaml)\n[![Report Card](https://goreportcard.com/badge/go.akshayshah.org/attest)](https://goreportcard.com/report/go.akshayshah.org/attest)\n[![GoDoc](https://pkg.go.dev/badge/go.akshayshah.org/attest.svg)](https://pkg.go.dev/go.akshayshah.org/attest)\n\n`attest` is a small package of type-safe assertion helpers. Under the hood,\nit uses [cmp] for equality testing and diffing. You may enjoy `attest` if you\nprefer:\n\n- Type safety: it's impossible to compare values with different types.\n- Brevity: assertions usually print diffs rather than full values.\n- Minimalism: just a few assertions, not a whole DSL.\n- Natural ordering: every assertion uses `got == want` order.\n- Interoperability: assertions work with any `cmp.Option`.\n\n## Installation\n\n```\ngo get go.akshayshah.org/attest\n```\n\n## Usage\n\n```go\npackage main\n\nimport (\n  \"testing\"\n  \"time\"\n\n  \"go.akshayshah.org/attest\"\n)\n\nfunc TestExample(t *testing.T) {\n  attest.Equal(t, 1, 1)\n  attest.NotEqual(t, 2, 1)\n  attest.Approximately(\n    t,\n    time.Minute - 1, // got\n    time.Minute,     // want\n    time.Second,     // tolerance\n  )\n  attest.Zero(t, \"\")\n  attest.Contains(t, []int{0, 1, 2}, 2)\n\n  var err error\n  attest.Ok(t, err)\n  err = fmt.Errorf(\"read config: %w\", io.EOF)\n  attest.Error(t, err)\n  attest.ErrorIs(t, err, io.EOF)\n\n  // You can enrich the default failure message.\n  attest.Equal(t, 1, 2, attest.Sprintf(\"integer %s\", \"addition\"))\n\n  // The next two assertions won't compile.\n  attest.Equal(t, int64(1), int(1))\n  attest.Approximately(t, 9, 10, 0.5)\n}\n```\n\nFailed assertions usually print a diff. Here's an example using `attest.Equal`:\n\n```\n--- FAIL: TestEqual (0.00s)\n    attest_test.go:58: got != want\n        diff (+got, -want):\n          attest.Point{\n                X: 1,\n        -       Y: 4.2,\n        +       Y: 3.5,\n          }\n```\n\n## Status: Stable\n\nThis module is stable. It supports the [two most recent major\nreleases][go-support-policy] of Go.\n\nWithin those parameters, `attest` follows semantic versioning. No\nbreaking changes will be made without incrementing the major version.\n\n## Legal\n\nOffered under the [MIT license][license].\n\n[cmp]: https://pkg.go.dev/github.com/google/go-cmp/cmp\n[go-support-policy]: https://golang.org/doc/devel/release#policy\n[license]: https://github.com/akshayjshah/attest/blob/main/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakshayjshah%2Fattest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakshayjshah%2Fattest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakshayjshah%2Fattest/lists"}