{"id":22477089,"url":"https://github.com/kapetndev/expect","last_synced_at":"2025-06-12T00:35:36.951Z","repository":{"id":57569266,"uuid":"344296692","full_name":"kapetndev/expect","owner":"kapetndev","description":"A (very) simple expectation, and diff, package for use in test suites.","archived":false,"fork":false,"pushed_at":"2021-04-06T11:08:51.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-01T20:46:15.952Z","etag":null,"topics":["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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kapetndev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2021-03-03T23:53:52.000Z","updated_at":"2023-03-18T23:21:00.000Z","dependencies_parsed_at":"2022-08-23T18:11:18.361Z","dependency_job_id":null,"html_url":"https://github.com/kapetndev/expect","commit_stats":null,"previous_names":["crumbandbase/expect"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapetndev%2Fexpect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapetndev%2Fexpect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapetndev%2Fexpect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapetndev%2Fexpect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kapetndev","download_url":"https://codeload.github.com/kapetndev/expect/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245897285,"owners_count":20690454,"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":["golang","testing"],"created_at":"2024-12-06T14:09:28.742Z","updated_at":"2025-03-27T17:43:55.660Z","avatar_url":"https://github.com/kapetndev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# expect ![test](https://github.com/crumbandbase/expect/workflows/test/badge.svg?event=push)\n\nA (very) simple expectation, and `diff`, package for use in test suites.\n\n## Prerequisites\n\nYou will need the following things properly installed on your computer.\n\n* [Go](https://golang.org/): any one of the **three latest major**\n  [releases](https://golang.org/doc/devel/release.html)\n\n## Installation\n\nWith [Go module](https://github.com/golang/go/wiki/Modules) support (Go 1.11+),\nsimply add the following import\n\n```go\nimport \"github.com/crumbandbase/expect\"\n```\n\nto your code, and then `go [build|run|test]` will automatically fetch the\nnecessary dependencies.\n\nOtherwise, to install the `expect` package, run the following command:\n\n```bash\n$ go get -u github.com/crumbandbase/expect\n```\n\n## Usage\n\nIn the simple case where two like values need to be tested for equality the\n`expect.Equal` function can be used.\n\n```go\npackage main_test\n\nimport (\n  \"testing\"\n\n  \"github.com/crumbandbase/expect\"\n)\n\nfunc TestGreeting(t *testing.T) {\n\tt.Run(\"succeeds when the greetings are equal\", func(t *testing.T) {\n\t\texpected := \"Hello, Picard\"\n\t\tgot := greeting(\"Picard\")\n\n\t\texpect.Equal(t, got, expected, \"greetings were not equal\")\n\t})\n\n\tt.Run(\"fails when the greeting are not equal\", func(t *testing.T) {\n\t\texpected := \"Bonjour, Picard\"\n\t\tgot := greeting(\"Picard\")\n\n\t\texpect.Equal(t, got, expected, \"greetings were not equal\")\n\t})\n}\n```\n\nIn the above the second test will fail and will produce a `diff` describing the\ndifferences. This is handled by the brilliant\n[go-cmp](https://github.com/google/go-cmp) package. For example the output\nthat will be printed for this test suite is:\n\n```bash\nexpect.go:15: greetings were not equal\nexpect.go:16:\n      string(\n    -       \"Hello, Picard\",\n    +       \"Bonjour, Picard\",\n      )\n```\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkapetndev%2Fexpect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkapetndev%2Fexpect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkapetndev%2Fexpect/lists"}