{"id":16881638,"url":"https://github.com/benbjohnson/prog","last_synced_at":"2025-03-20T03:35:06.060Z","repository":{"id":33626071,"uuid":"37278348","full_name":"benbjohnson/prog","owner":"benbjohnson","description":"Go testing","archived":false,"fork":false,"pushed_at":"2015-06-11T18:26:43.000Z","size":100,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T23:56:14.657Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benbjohnson.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":"2015-06-11T18:26:18.000Z","updated_at":"2022-04-05T08:47:57.000Z","dependencies_parsed_at":"2022-08-17T19:30:52.798Z","dependency_job_id":null,"html_url":"https://github.com/benbjohnson/prog","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benbjohnson%2Fprog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benbjohnson%2Fprog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benbjohnson%2Fprog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benbjohnson%2Fprog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benbjohnson","download_url":"https://codeload.github.com/benbjohnson/prog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244544821,"owners_count":20469738,"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":[],"created_at":"2024-10-13T16:04:31.128Z","updated_at":"2025-03-20T03:35:06.041Z","avatar_url":"https://github.com/benbjohnson.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Go: testing\n===========\n\nTesting in Go is very limited compared to some other languages, however,\nthe limited support is intentional. Rather than building a complex testing\nlanguage or a full featured testing library, Go uses the Go language itself.\n\nThe `testing` package in Go is broken down into 3 parts:\n\n1. Tests\n\n2. Benchmarks\n\n3. Examples\n\n\n## Tests\n\nTests are simple functions that begin with the word `Test` and accept a\n`*testing.T` object that is used to control the test. There are a few\noperations you can perform with the test object:\n\n* Fail - Marks a test as failed and stops immediately.\n\n* Error - Marks a test as failed but continues the test.\n\n* Skip - Marks a test as skipped and stops immediately.\n\n* Log - Print a message to the test's output buffer.\n\n* Parallel - Indicates that a test can be run in parallel with other tests.\n\nEach of these have helper functions to format log messages but this is\nessentially all you can do with a test. The control flow of the test is\nhandled by the Go language rather than assert statements or test-specific DSLs.\n\n\n## Benchmarks\n\nBenchmarks are simple functions that begin with the word `Benchmark` and\naccept a `*testing.B` object that is used to control the benchmark. A\nbenchmark largely supports the same operations as a test but also adds a\nfew additional operations:\n\n* N - This is the number of iterations to run in the benchmark.\n\n* ReportAllocs() - Enable the memory allocation reporting for the benchmark.\n\n* SetBytes() - Enable IO reporting for the benchmark.\n\n* ResetTimer() - Restarts the start time of the benchmark. Useful for setup code.\n\nThe Go toolchain will automatically adjust the number of iterations, `N`,\nuntil it can run a benchmark function for a minimum duration.\n\n\n## Examples\n\nExamples are functions that demonstrate some functionality of your packages\nthat will show up in godoc. The great part about examples is that Go will\nrun and test your example so you know that godoc examples should always work!\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenbjohnson%2Fprog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenbjohnson%2Fprog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenbjohnson%2Fprog/lists"}