{"id":38921951,"url":"https://github.com/maprost/testbox","last_synced_at":"2026-01-17T15:34:14.635Z","repository":{"id":57519865,"uuid":"134752937","full_name":"maprost/testbox","owner":"maprost","description":"toolbox for testing","archived":false,"fork":false,"pushed_at":"2023-04-13T10:39:58.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-15T14:19:18.711Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maprost.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}},"created_at":"2018-05-24T18:15:52.000Z","updated_at":"2025-02-06T12:38:07.000Z","dependencies_parsed_at":"2023-02-15T07:31:06.981Z","dependency_job_id":null,"html_url":"https://github.com/maprost/testbox","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/maprost/testbox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maprost%2Ftestbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maprost%2Ftestbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maprost%2Ftestbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maprost%2Ftestbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maprost","download_url":"https://codeload.github.com/maprost/testbox/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maprost%2Ftestbox/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28511620,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"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":[],"created_at":"2026-01-17T15:34:14.063Z","updated_at":"2026-01-17T15:34:14.617Z","avatar_url":"https://github.com/maprost.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/maprost/testbox.svg)](https://travis-ci.org/maprost/testbox)\n[![Coverage Status](https://coveralls.io/repos/github/maprost/testbox/badge.svg)](https://coveralls.io/github/maprost/testbox)\n[![GoDoc](https://godoc.org/github.com/maprost/testbox?status.svg)](https://godoc.org/github.com/maprost/testbox)\n[![Go Report Card](https://goreportcard.com/badge/github.com/maprost/testbox)](https://goreportcard.com/report/github.com/maprost/testbox)\n[![Version](https://img.shields.io/github/release/maprost/testbox.svg)](https://github.com/maprost/testbox/releases)\n\n# testbox\nlightweight test environment\n\n## Install\n```bash\ngo get github.com/maprost/testbox\n```\n\n## Supported methods\n- `should.BeEqual`(`t`, `element`, `element`) -\u003e check if two elements are equal\n- `should.NotBeEqual`(`t`,`element`, `element`) -\u003e check if two elements are not equal\n- `should.BeNil`(`t`,`element`)  -\u003e check if an element it nil\n- `should.NotBeNil`t`,`(`element`)  -\u003e check if an element is not nil\n- `should.BeTrue`(`t`,`element`)  -\u003e check if an element is `true`\n- `should.BeFalse`(`t`,`element`) -\u003e check if an element is `false`\n- `should.HaveLength`(`t`,`collection`, `length`) -\u003e (only for `array`/`slice`/`map`) check the length of the collection\n- `should.Contain`(`t`,`collection`, `element`) -\u003e (only for `array`/`slice`/`map`/`string`) check if the collection contains the element\n- `should.NotContain`(`t`,`collection`, `element`) -\u003e (only for `array`/`slice`/`map`) check if the collection contains not the element\n- `should.BeSimilar`(`t`,`collection`, `collection`) -\u003e (only for `array`/`slice`) check if the two collections contains the same elements\n- `should.NotBeSimilar`(`t`,`collection`, `collection`) -\u003e (only for `array`/`slice`) check if the two collections contains at least one different element\n- `should.Fail` -\u003e stops the tests with the given error message\n\nsame for `must`.\n\n## Usage\nPlease look into the test files to see the possibilities. For the first look\nhere some examples:\n\n```\nfunc TestSimple(t *testing.T) {\n\tshould.BeEqual(t, 1, 1, \"should be equal\")\n\tshould.BeNil(t, nil)\n\tshould.NotBeNil(t, 1)\n\tshould.BeTrue(t, true)\n\tshould.BeFalse(t, false)\n\tshould.NotBeEqual(t, 1, 2)\n\tshould.NotBeEqual(t, 1.0, 1)\n\tshould.NotBeEqual(t, int64(1), int32(1))\n}\n\nfunc TestDataStructures(t *testing.T) {\n\tshould.HaveLength(t, []int{1, 2, 3}, 3)\n\tshould.HaveLength(t, [3]int{1, 2, 3}, 3)\n\tshould.HaveLength(t, map[int]int{1: 1, 2: 3, 3: 5}, 3)\n\tshould.BeEqual(t, []int{1, 2, 3}, []int{1, 2, 3})\n\tshould.NotBeEqual(t, []int{1, 2, 3}, []int{3, 2, 1})\n\tshould.BeSimilar(t, []int{1, 2, 3}, []int{3, 2, 1})\n\tshould.BeSimilar(t, []int{1, 2, 3}, [3]int{3, 2, 1})\n\tshould.NotBeSimilar(t, []int{1, 2, 3}, [3]int{3, 2, 4})\n\tshould.NotBeSimilar(t, []int{1, 2, 3}, []int{2, 3, 4, 1})\n\tshould.NotBeEqual(t, []int{1, 2, 3}, [3]int{1, 2, 3})\n\tshould.BeEqual(t, [3]int{1, 2, 3}, [3]int{1, 2, 3})\n\tshould.Contain(t, []int{1, 2, 3}, 2)\n\tshould.NotContain(t, []int{1, 2, 3}, 4)\n\tshould.Contain(t, [3]int{1, 2, 3}, 3)\n\tshould.NotContain(t, [3]int{1, 2, 3}, 4)\n\tshould.BeEqual(t, map[int]string{1: \"1\", 2: \"2\", 3: \"3\"}, map[int]string{1: \"1\", 2: \"2\", 3: \"3\"})\n\tshould.NotBeEqual(t, map[int]string{1: \"1\", 3: \"3\"}, map[int]string{1: \"1\", 4: \"4\"})\n\tshould.BeEqual(t, map[int]string{1: \"1\", 3: \"3\"}, map[int]string{3: \"3\", 1: \"1\"})\n\tshould.Contain(t, map[int]string{1: \"11\", 3: \"33\"}, \"33\")\n\tshould.NotContain(t, map[int]string{1: \"11\", 3: \"33\"}, \"55\")\n}\n\nfunc TestStructs(t *testing.T) {\n\ttype Post struct {\n\t\tId  int64\n\t\tMsg string\n\t}\n\n\tp1 := Post{Id: 12, Msg: \"New\"}\n\tp2 := Post{Id: 12, Msg: \"New\"}\n\tp3 := Post{Id: 12, Msg: \"Old\"}\n\n\tshould.BeEqual(t, p1, p1)\n\tshould.BeEqual(t, p1, p2)\n\tshould.BeEqual(t, \u0026p1, \u0026p2)\n\tshould.NotBeEqual(t, p1, p3)\n\tshould.NotBeEqual(t, p1, \u0026p1)\n\n\tshould.BeEqual(t, []Post{p1}, []Post{p2})\n\tshould.NotBeEqual(t, []Post{p1}, []Post{p3})\n\tshould.Contain(t, []Post{p1, p2, p3}, p3)\n\tshould.Contain(t, []*Post{\u0026p1, \u0026p2, \u0026p3}, \u0026p3)\n\tshould.Contain(t, []*Post{\u0026p1, \u0026p3}, \u0026p2)\n\tshould.NotContain(t, []Post{p1, p2}, p3)\n\tshould.NotContain(t, []Post{p1}, 22)\n\tshould.NotContain(t, []Post{}, p1)\n\tshould.NotContain(t, []*Post{\u0026p1, \u0026p2}, \u0026p3)\n\tshould.NotContain(t, []*Post{\u0026p1, \u0026p2}, p2)\n\n\tshould.BeEqual(t, [1]Post{p1}, [1]Post{p2})\n\tshould.NotBeEqual(t, [1]Post{p1}, [1]Post{p3})\n\tshould.Contain(t, [2]Post{p1, p2}, p2)\n\tshould.Contain(t, [3]*Post{\u0026p1, \u0026p2, \u0026p3}, \u0026p3)\n\tshould.Contain(t, [2]*Post{\u0026p1, \u0026p3}, \u0026p2)\n\tshould.NotContain(t, [2]Post{p1, p2}, p3)\n\tshould.NotContain(t, [1]Post{p1}, \"blob\")\n\tshould.NotContain(t, [0]Post{}, p1)\n\tshould.NotContain(t, [2]*Post{\u0026p1, \u0026p2}, \u0026p3)\n\tshould.NotContain(t, [2]*Post{\u0026p1, \u0026p2}, p1)\n\n\tshould.BeEqual(t, map[int]Post{1: p1}, map[int]Post{1: p2})\n\tshould.NotBeEqual(t, map[int]Post{1: p1}, map[int]Post{1: p3})\n\tshould.NotBeEqual(t, map[int]Post{1: p1}, map[int]Post{2: p1})\n\tshould.Contain(t, map[int]Post{1: p1, 2: p2}, p2)\n\tshould.Contain(t, map[int]*Post{1: \u0026p1, 2: \u0026p2}, \u0026p2)\n\tshould.NotContain(t, map[int]Post{1: p1, 2: p2}, p3)\n\tshould.NotContain(t, map[int]Post{1: p1}, \"blob\")\n\tshould.NotContain(t, map[int]Post{}, p1)\n\tshould.NotContain(t, map[int]*Post{1: \u0026p1}, p1)\n}\n```\n\n## Output\nThe output of a failed test shows you the actual and expected value and a stacktrace.\n```\nshould.go:75: Not equal:\n\t  actual: 1(float64)\n\texpected: 1(int)\n\t/.../src/github.com/maprost/should/failing_test.go:12 +0xd1\n\t/usr/local/go/src/testing/testing.go:657 +0x96\n\t/usr/local/go/src/testing/testing.go:697 +0x2ca\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaprost%2Ftestbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaprost%2Ftestbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaprost%2Ftestbox/lists"}