1
0
mirror of https://github.com/golang/go synced 2024-11-27 02:31:18 -07:00
go/src/testing
Leigh McCulloch 8f4bc468a7 testing: add example to package doc
The package doc for the testing package doesn't have a simple
example demonstrating how to write a test with an expectation. The doc
has simple examples for benchmarks, examples, and skipping, and it would be
useful for people new to writing tests in Go.

Also moved the skip example further down because it references tests and
benchmarks but benchmarks haven't been discussed in detail until the
next section. Skip is also a less used feature and it seems misplaced to
sit so high up in the package documentation. As an example, Skip is used
570 times the Go code repository which is significantly less than Error
and Fatal that are used 23,303 times.

Also changed 'sample' to 'simple' in other places in the package documentation
to keep the language used consistent when describing the small examples.

Fixes #27839

Change-Id: Ie01a3751986ee61adf2a2f2eda59cc182342baa7
GitHub-Last-Rev: 7357bfdcd2
GitHub-Pull-Request: golang/go#27840
Reviewed-on: https://go-review.googlesource.com/c/137175
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2018-11-16 16:49:09 +00:00
..
internal/testdeps runtime/pprof: introduce "allocs" profile 2018-04-24 16:11:41 +00:00
iotest testing/iotest: fix NewReadLogger documentation typo 2017-10-19 15:59:21 +00:00
quick doc: mention testing/quick RNG seeding change in Go 1.9 notes 2017-06-27 22:41:49 +00:00
allocs_test.go
allocs.go
benchmark_test.go
benchmark.go testing: implement -benchtime=100x 2018-10-12 17:48:31 +00:00
cover.go testing/cover: improve comments on CoverBlock 2018-07-01 08:07:47 +00:00
example.go all: use strings.Builder instead of bytes.Buffer where appropriate 2018-03-26 23:05:53 +00:00
export_test.go
helper_test.go testing: allow marking subtest and subbenchmark functions as Helpers 2018-05-14 17:59:59 +00:00
helperfuncs_test.go testing: allow marking subtest and subbenchmark functions as Helpers 2018-05-14 17:59:59 +00:00
match_test.go testing: harmonize handling of prefix-matched benchmarks 2017-06-20 14:19:05 +00:00
match.go testing: fix typo mistake 2018-04-27 13:29:12 +00:00
sub_test.go testing: implement -benchtime=100x 2018-10-12 17:48:31 +00:00
testing_test.go
testing.go testing: add example to package doc 2018-11-16 16:49:09 +00:00