]> Cypherpunks repositories - gostls13.git/commit
testing: add example to package doc
authorLeigh McCulloch <leigh@mcchouse.com>
Fri, 16 Nov 2018 02:20:58 +0000 (02:20 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 16 Nov 2018 16:49:09 +0000 (16:49 +0000)
commit8f4bc468a7f5846149d7f0b51633c6fea3861515
tree6ece6df0ff1b64003375ce7414fe2f49165d939c
parentb1e8846dfb619dedbb90ef0b8edbbde2f5e766ea
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: 7357bfdcd29ed1dc1719c9436b5d5420020610ee
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>
src/testing/testing.go