{"id":16308962,"url":"https://github.com/bayashi/actually","last_synced_at":"2025-10-16T22:14:07.861Z","repository":{"id":152292760,"uuid":"625700395","full_name":"bayashi/actually","owner":"bayashi","description":"A testing library focused on turning failure into success","archived":false,"fork":false,"pushed_at":"2024-09-02T16:12:32.000Z","size":256,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-11T21:19:14.282Z","etag":null,"topics":["actually","assertion","assertions","go","go-testing","golang","golang-testing","testing","testing-golang"],"latest_commit_sha":null,"homepage":"https://github.com/bayashi/actually/wiki","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/bayashi.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":"2023-04-09T22:53:27.000Z","updated_at":"2024-07-07T11:22:51.000Z","dependencies_parsed_at":"2023-12-17T06:20:14.922Z","dependency_job_id":"b8e7036d-1d59-4065-9c4a-038905846e2f","html_url":"https://github.com/bayashi/actually","commit_stats":null,"previous_names":[],"tags_count":57,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bayashi%2Factually","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bayashi%2Factually/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bayashi%2Factually/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bayashi%2Factually/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bayashi","download_url":"https://codeload.github.com/bayashi/actually/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244084988,"owners_count":20395522,"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":["actually","assertion","assertions","go","go-testing","golang","golang-testing","testing","testing-golang"],"created_at":"2024-10-10T21:19:19.138Z","updated_at":"2025-10-16T22:14:07.839Z","avatar_url":"https://github.com/bayashi.png","language":"Go","readme":"# Actually\n\n\u003ca href=\"https://github.com/bayashi/actually/actions\"\u003e\u003cimg src=\"https://github.com/bayashi/actually/workflows/main/badge.svg?_t=1681289447\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://goreportcard.com/report/github.com/bayashi/actually\" title=\"actually report card\" target=\"_blank\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/bayashi/actually\" alt=\"actually report card\"\u003e\u003c/a\u003e\n\u003ca href=\"https://pkg.go.dev/github.com/bayashi/actually\" target=\"_blank\"\u003e\u003cimg src=\"https://pkg.go.dev/badge/github.com/bayashi/actually.svg\" alt=\"Go Reference\"\u003e\u003c/a\u003e\n\nA testing library focused on turning failure into success, `actually`.\n\n* It is clear what is being tested by the builder interface\n* Consistent method names to reduce things you have to memorize\n* Explicit test failure results help you save time\n* There are helper methods to see details of a failure\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"testing\"\n\n\ta \"github.com/bayashi/actually\"\n\tpb \"github.com/bayashi/actually/testpb\"\n)\n\nfunc TestObject(t *testing.T) {\n\tlove, err := getLove()\n\n\ta.Got(err).NoError(t)\n\ta.Got(love).True(t)\n}\n\nfunc getLove() (bool, error) {\n\treturn true, nil\n}\n\nfunc TestObjects(t *testing.T) {\n\tx := map[string]int{\n\t\t\"foo\": 123,\n\t}\n\ty := map[string]int{\n\t\t\"foo\": 123,\n\t}\n\n\t// `Same` method verifies that two objects are same in value and type.\n\t// Function type value is not acceptable. And not verify pointer address.\n\t// It will be fail, int(1) and uint(1), because of type.\n\ta.Got(x).Expect(y).Same(t)\n\n\t// Cmp method gets the differences between two objects by go-cmp.Diff.\n\ta.Got(x).Expect(y).Cmp(t)\n}\n\nfunc TestProtoMessages(t *testing.T) {\n\tx := \u0026pb.Foo{Id: 123}\n\ty := \u0026pb.Foo{Id: 123}\n\n\t// CmpProto method gets the differences between two Protobuf messages\n\t// by go-cmp.Diff with protocmp.Transform option.\n\ta.Got(x).Expect(y).CmpProto(t)\n\n\ta.Got(x).Expect(y).SamePointer(t) // This test will be failed\n}\n```\n\n## Assertion Methods\n\n### [For 1 object](https://github.com/bayashi/actually/wiki/All-assertion-methods#assertion-for-1-object)\n\n* True, False, Nil, NotNil, NoError\n\n### [For 2 objects](https://github.com/bayashi/actually/wiki/All-assertion-methods#assertion-for-2-objects)\n\n* Same, SamePointer, SameType, SameConvertibleNumber\n* NotSame, NotSamePointer, NotSameType, NotSameConvertibleNumber\n* Cmp, CmpProto, CmpAllowUnexported, CmpIgnoreUnexported, (CmpOpt)\n\n### [For panic](https://github.com/bayashi/actually/wiki/All-assertion-methods#assertion-for-panic)\n\n* Panic, NoPanic, PanicMessage\n\n### [For string value by regexp](https://github.com/bayashi/actually/wiki/All-assertion-methods#assertion-for-string-value-by-regexp)\n\n* Match, NotMatch\n\n### [For length of an object](https://github.com/bayashi/actually/wiki/All-assertion-methods#assertion-for-length-of-an-object)\n\n* Len\n\n## Helper Methods\n\n* **FailNow**: Halt the test case immediately when the test fails\n* **Diff**: Get diff of 2 objects on anywhere\n* **Dump**: Get dumped string of objects on anywhere\n* **Debug**: Show debug info only on failure\n\n[See more helper functions](https://github.com/bayashi/actually/wiki/Helper-functions).\n\n[Here is a Wiki of full API documentation](https://github.com/bayashi/actually/wiki).\n\n-----\n\n## Fail reports\n\n`actually` will help you with evident fail report:\n\n```go\npackage foo\n\nimport (\n\t\"testing\"\n\n\ta \"github.com/bayashi/actually\"\n)\n\nfunc Test(t *testing.T) {\n\tx := \"foo\\nbar\\nbaz\"\n\ty := \"foo\\nbar\\nbug\"\n\n\ta.Got(x).Expect(y).Same(t)\n}\n```\n\nAbove code will put fail report like below:\n\n```\n=== RUN   Test\n    foo_test.go:13: Test\n        Fail reason:    Not same value\n        Type:           Expect:string, Got:string\n        Expected:       \"foo\\nbar\\nbug\"\n        Actually got:   \"foo\\nbar\\nbaz\"\n        Diff details:   --- Expected\n                        +++ Actually got\n                        @@ -2,2 +2,2 @@\n                         bar\n                        -bug\n                        +baz\n        Trace:          /path/to/foo/foo_test.go:13\n--- FAIL: Test (0.00s)\n```\n\n## ACTUALLY_TRACE_SOURCE\n\nIf you set true value (i.e. \"1\", \"true\" or \"TRUE\" etc) into ENV:`ACTUALLY_TRACE_SOURCE` on running a test, then you can see a piece of source code for each stack trace in fail report.\n\n```\n=== RUN   Test\n    foo_test.go:13: Test\n        Fail reason:    Not same value\n        Type:           Expect:string, Got:string\n        Expected:       \"foo\\nbar\\nbug\"\n        Actually got:   \"foo\\nbar\\nbaz\"\n        Diff details:   --- Expected\n                        +++ Actually got\n                        @@ -2,2 +2,2 @@\n                         bar\n                        -bug\n                        +baz\n        Trace:          /path/to/foo/foo_test.go:13\n                         10     x := \"foo\\nbar\\nbaz\"\n                         11     y := \"foo\\nbar\\nbug\"\n                         12\n                         13\u003e    a.Got(x).Expect(y).Same(t)\n                         14  }\n--- FAIL: Test (0.00s)\n```\n\n-----\n\n## Installation\n\n    go get github.com/bayashi/actually\n\n## License\n\nMIT License\n\n## Author\n\nDai Okabayashi: https://github.com/bayashi\n\n## Special Thanks\n\nInspired by:\n\n* https://github.com/stretchr/testify\n* https://github.com/matryer/is\n* https://github.com/fluentassert/verify\n* https://metacpan.org/pod/Test::Arrow\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbayashi%2Factually","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbayashi%2Factually","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbayashi%2Factually/lists"}