{"id":26698831,"url":"https://github.com/iwittkau/th","last_synced_at":"2025-03-26T22:20:00.002Z","repository":{"id":59045394,"uuid":"470334512","full_name":"iwittkau/th","owner":"iwittkau","description":"Experimental generic Go test helpers","archived":false,"fork":false,"pushed_at":"2022-03-16T12:17:59.000Z","size":5,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-20T02:06:38.624Z","etag":null,"topics":["generics","generics-in-golang","go","golang","testing"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iwittkau.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-15T21:17:17.000Z","updated_at":"2024-06-20T02:06:38.625Z","dependencies_parsed_at":"2022-09-11T06:51:38.067Z","dependency_job_id":null,"html_url":"https://github.com/iwittkau/th","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwittkau%2Fth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwittkau%2Fth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwittkau%2Fth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwittkau%2Fth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iwittkau","download_url":"https://codeload.github.com/iwittkau/th/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245743426,"owners_count":20665094,"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":["generics","generics-in-golang","go","golang","testing"],"created_at":"2025-03-26T22:19:59.638Z","updated_at":"2025-03-26T22:19:59.997Z","avatar_url":"https://github.com/iwittkau.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"test helpers\n====\n\n# Packages\n\nThis module contains test helpers for one-parameter-input-two-parameter-return style functions (e.g. `json.Marshal`, `os.Open`, etc.).\n\nPackage `must` uses `t.Fatal` to report any errors; package `should` uses `t.Error` to report any errors.\n\n# Example\n\n```go\npackage test\n\nimport (\n\t\"encoding/json\"\n\t\"os\"\n\t\"testing\"\n\n\t\"github.com/iwittkau/th/must\"\n\t\"github.com/iwittkau/th/should\"\n)\n\nfunc TestExamples(t *testing.T) {\n\tdata := must.Return[any](t, []string{\"test\"}, json.Marshal) // type of input must be passed; return type []byte automatically inferred\n\tt.Log(string(data))\n\n\tf := should.Return(t, \"must.go\", os.Open) // returns an *os.File (automatically inferred)\n\tdefer f.Close()\n}\n```\n\n# Installation\n\nThis module is based on Go's generics support which was introduced in Go 1.18, therefor this module requires Go 1.18.\n\n```\ngo get github.com/iwittkau/th\n```\n\n# Inspiration\n\nThe simple API design and the idea to separate the helpers into two packages was inspired by [testify's](https://github.com/stretchr/testify) `assert` and `require` packages.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiwittkau%2Fth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiwittkau%2Fth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiwittkau%2Fth/lists"}