{"id":37972680,"url":"https://github.com/youta-t/its","last_synced_at":"2026-01-16T18:25:30.435Z","repository":{"id":221157194,"uuid":"753606238","full_name":"youta-t/its","owner":"youta-t","description":"its a matcher library for go","archived":false,"fork":false,"pushed_at":"2025-06-29T12:52:51.000Z","size":319,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-29T13:43:23.267Z","etag":null,"topics":["assertion-library","go","golang","its","matchers","test","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/youta-t.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-02-06T13:06:57.000Z","updated_at":"2025-06-29T12:52:31.000Z","dependencies_parsed_at":"2024-03-23T06:26:54.337Z","dependency_job_id":"3af57ccf-1a04-49fa-bdab-eeb161747973","html_url":"https://github.com/youta-t/its","commit_stats":null,"previous_names":["youta-t/its"],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/youta-t/its","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youta-t%2Fits","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youta-t%2Fits/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youta-t%2Fits/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youta-t%2Fits/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/youta-t","download_url":"https://codeload.github.com/youta-t/its/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youta-t%2Fits/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28480731,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["assertion-library","go","golang","its","matchers","test","testing"],"created_at":"2026-01-16T18:25:30.339Z","updated_at":"2026-01-16T18:25:30.408Z","avatar_url":"https://github.com/youta-t.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"its  --  A Matcher Library\n================================\n\nWhat it is? -- yes, it's its.\n------------------------------\n\n`its` provides value matchers, matcher generator and mock generator.\n\nInstall\n---------\n\n```\ngo get github.com/youta-t/its\n```\n\nIts requires go1.21+.\n\nCore package: `its`\n------------------\n\n`github.com/youta-t/its` package is core package.\nBuilt-in mathcers are here.\n\nFor example, `its.EqEq` matcher is for `comparable`.\n\n```go\nimport (\n\t\"testing\"\n\n\t\"github.com/youta-t/its\"\n)\n\nfunc Add(a, b int) int {\n\treturn a + b\n}\n\nfunc TestAdd(t *testing.T) {\n\tgot := Add(3, 7)\n\tits.EqEq(10).   // want is 10\n\t\tMatch(got). // got\n\t\tOrError(t)  // test\n}\n```\n\nIt passes becauase `10 == 3 + 7` is true.\n\nAll matchers have example. See them in pkg.go.dev:\nhttps://pkg.go.dev/github.com/youta-t/its and [doc/getting-started](./doc/getting-started.md).\n\nIf unmatch is fatal, you can do so.\n\n```go\nimport (\n\t\"testing\"\n\t\"errors\"\n\n\t\"github.com/youta-t/its\"\n)\n\nfunc Div(a, b float64) (float64, error) {\n\tif b == 0 {\n\t\treturn 0, errors.New(\"zero div!\")\n\t}\n\treturn a + b\n}\n\nfunc TestAdd(t *testing.T) {\n\t_, err := Div(3, 0)\n\tits.Nil[error](). // want is nil.\n\t\tMatch(err).   // got\n\t\tOrFatal(t)    // test\n}\n```\n\n### Nice message\n\nIf it does not match, it leave nice message.\n\n```go\nimport \"testing\"\n\nimport \"github.com/youta-t/its\"\n\n// ...\n\nfunc Add(a, b int) int {\n\treturn a + b\n}\n\nfunc TestAdd(t *testing.T) {\n\tgot := Add(3, 7)\n\tits.EqEq(got).Match(10).OrError(t)\n\tits.EqEq(got).Match(11).OrError(t)\n}\n```\n\nprovides,\n\n```\n--- FAIL: TestAdd (0.00s)\n✘ /* got */ 11 == /* want */ 10\t\t--- @.../example_test.go:33:\n```\n\nError message is tailored for each matchers.\n\nGenerally, each messages start with...\n\n- `✔ `: passed matcher\n- `✘ `: failed matcher\n- `~ `: failed matcher, but not matter\n\n### Composeable\n\nMathers of its can be composed. For example,\n\n```go\npackage example_test\n\nimport (\n\t\"testing\"\n\n\t\"github.com/youta-t/its\"\n)\n\nfunc TestBetween(t *testing.T) {\n\tits.All(\n\t\tits.GreaterThan(3),\n\t\tits.LesserEq(8),\n\t).Match(7).OrError(t)  // pass. 3 \u003c 7 \u003c= 8\n\n\tits.All(\n\t\tits.GreaterThan(3),\n\t\tits.LesserEq(8),\n\t).Match(8).OrError(t)  // pass. 3 \u003c 8 \u003c= 8\n\n\tits.All(\n\t\tits.GreaterThan(3),\n\t\tits.LesserEq(8),\n\t).Match(9).OrError(t) // fail! 3 \u003c 9 \u003c= 8\n}\n```\n\nprovides,\n\n```\n--- FAIL: TestBetween (0.00s)\n✘ // all: (1 ok / 2 matchers)\t\t--- @.../example_test.go:19\n    ✔ /* want */ 3 \u003c /* got */ 9\t\t--- @ .../example_test.go:20\n    ✘ /* want */ 8 \u003e /* got */ 9\t\t--- @ .../example_test.go:21\n```\n\n\"A between B\" means \"greater than A, and lesser than B\".\n\nthere are also `Some` (require match at least one), `Not` (invert match) and `None` (= `Not(Some(...))` + better message).\n\nGenerate Struct Matcher: structer\n---------------------------------\n\n`its` has a tool for `//go:generate` to generate matchers of struct, `github.com/youta-t/its/structer`.\n\nYou can get matchers for structs, `type T []E` and `type T map[K]E` (alias of slice/map) in and not in your package.\n\nSee [structer/README.md](./structer/README.md) for more details.\n\nGenerate Mocks: mocker\n----------------------\n\nThere are another `//go:generate` feature to generate mocks of functions and interfaces, `github.com/youta-t/its/mocker`.\n\nYou can mock builders for each `type ... interface` and `type ... func`.\n\nAnd more, there are \"scenario\" test feature to check injected functions are called in exact order.\n\nSee [mocker/README.md](./mocker/README.md) for more details.\n\nDIY kit included\n-----------------\n\nMatcher developmenet kit, `itskit`, is included.\n\nYou can create your matcher from scratch in 50 lines or so.\nOr, in the simplest case, you need just 10 lines per one matcher.\n\nSee [doc/how-to-write-my-matcher.md](./doc/how-to-write-my-matcher.md) to know how to.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyouta-t%2Fits","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyouta-t%2Fits","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyouta-t%2Fits/lists"}