{"id":20635810,"url":"https://github.com/orsinium-labs/tinytest","last_synced_at":"2025-04-15T21:26:38.751Z","repository":{"id":225500911,"uuid":"766136714","full_name":"orsinium-labs/tinytest","owner":"orsinium-labs","description":"✅ The only assertion library that works with TinyGo","archived":false,"fork":false,"pushed_at":"2024-03-02T18:28:53.000Z","size":10,"stargazers_count":32,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T01:34:21.018Z","etag":null,"topics":["assert","assertions","framework","generics","go","golang","test","testify","testing","tinygo"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/orsinium-labs/tinytest/is","language":"Go","has_issues":false,"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/orsinium-labs.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}},"created_at":"2024-03-02T12:47:43.000Z","updated_at":"2024-07-31T05:01:49.000Z","dependencies_parsed_at":"2024-06-21T13:06:51.060Z","dependency_job_id":"e65cddf7-4e01-4cd1-9ac9-6d4b8540ada7","html_url":"https://github.com/orsinium-labs/tinytest","commit_stats":null,"previous_names":["orsinium-labs/tinytest"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orsinium-labs%2Ftinytest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orsinium-labs%2Ftinytest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orsinium-labs%2Ftinytest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orsinium-labs%2Ftinytest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orsinium-labs","download_url":"https://codeload.github.com/orsinium-labs/tinytest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249156013,"owners_count":21221697,"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","framework","generics","go","golang","test","testify","testing","tinygo"],"created_at":"2024-11-16T15:07:36.770Z","updated_at":"2025-04-15T21:26:38.731Z","avatar_url":"https://github.com/orsinium-labs.png","language":"Go","funding_links":[],"categories":["Embedded Systems"],"sub_categories":["General use"],"readme":"# tinytest\n\nThe only assertion library that works with [TinyGo](https://tinygo.org/).\n\n* **Why does nothing else work?** All assertion libraries use [reflect](https://pkg.go.dev/reflect) to compare values and to generate error messages. However, TinyGo [has very limited support for reflection](https://tinygo.org/docs/reference/lang-support/#reflection) which is not enough for any of the assertion libraries, including [testify](https://github.com/stretchr/testify) and [is](https://github.com/matryer/is).\n* **How does this work?** Instead of reflection, tinytest uses generics for comparing values and fmt for generating error messages.\n* **Why would I need an assertion library?** Testing with just the standard library is quite verbose. Tests should be easy to write (people already don't like writing tests, don't make it even more difficult) and easy to read and understand.\n* **Is it stable?** What is already here is pretty stable and reliable. The API might change slightly if I come up with a better one. New features and assertions might be added over time if there is demand. Error messages can change in any release.\n\nFeatures:\n\n* 🪶 Zero dependencies\n* 🐹 Pure Go\n* ✅ Works both with Go and TinyGo\n* 🧠 A simple API inspired by [is](https://github.com/matryer/is) and [testify](https://github.com/stretchr/testify)\n\n## 📦 Installation\n\n```bash\ngo get github.com/orsinium-labs/tinytest\n```\n\n## 🔧 Usage\n\n```go\nimport (\n    \"testing\"\n    \"github.com/orsinium-labs/tinytest/is\"\n)\n\nfunc TestHello(t *testing.T) {\n    c := is.NewRelaxed(t)\n    is.Equal(c, hello(), \"Hello world!\")\n}\n```\n\nRunning tests:\n\n```bash\ntinygo test ./...\n```\n\nIf you want to negate the check, wrap `c` into [is.Not](https://pkg.go.dev/github.com/orsinium-labs/tinytest/is#Not):\n\n```go\n// asserts that the string is not empty\nis.Equal(is.Not(c), hello(), \"\")\n```\n\nIf you want to provide an additional error message, use [t.Log](https://pkg.go.dev/testing#T.Log) or [t.Logf](https://pkg.go.dev/testing#T.Logf):\n\n```go\nt.Log(\"greet Joe\")\nis.Equal(c, Greet(\"Joe\"), \"Hello, Joe\")\n```\n\nOr [t.Run](https://pkg.go.dev/testing#T.Run) to run a subtest with the given name:\n\n```go\nt.Run(\"greet_joe\", func(t *testing.T) {\n    is.Equal(c, Greet(\"Joe\"), \"Hello, Joe\")\n})\n```\n\n📚 Check out [documentation](https://pkg.go.dev/github.com/orsinium-labs/tinytest/is) for the list of available assertions.\n\n## 🙅 Known limitations\n\nIf you try to call [t.FailNow](https://pkg.go.dev/testing#T.FailNow) from TinyGo tests, you'll get the following error message:\n\n```text\nFailNow is incomplete, requires runtime.Goexit()\n```\n\nWhich means that currently calling `FailNow` does not interrupt the tests. For this reason, tinytest provides only [NewRelaxed](https://pkg.go.dev/github.com/orsinium-labs/tinytest/is#NewRelaxed) function that configures all assertions to use `Fail` instead of `FailNow` and do not interrupt tests on failures. In future versions, we might to find a workaround for this limitation and then tinytest will also provide a `New` function that interrupts the tests immediately.\n\nAs a workaround, you can explicitly check at critical points if the test has failed and interrupt execution:\n\n```go\nif t.Failed() {\n    return\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forsinium-labs%2Ftinytest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forsinium-labs%2Ftinytest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forsinium-labs%2Ftinytest/lists"}