Skip to content

testing: add example to package doc #27840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed

testing: add example to package doc #27840

wants to merge 6 commits into from

Conversation

leighmcculloch
Copy link
Contributor

@leighmcculloch leighmcculloch commented Sep 25, 2018

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

@googlebot googlebot added the cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change. label Sep 25, 2018
@gopherbot
Copy link
Contributor

This PR (HEAD: e7e57f5) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/137175 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

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.
@gopherbot
Copy link
Contributor

This PR (HEAD: 37853b5) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/137175 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Gerrit User 5137:

Patch Set 2: Run-TryBot+1 Code-Review+2

Thank you for this change Leigh! LGTM.


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 5976:

Patch Set 2:

TryBots beginning. Status page: https://farmer.golang.org/try?commit=102ca3ab


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 5976:

Patch Set 2: TryBot-Result+1

TryBots are happy.


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 5015:

Patch Set 2:

(3 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR (HEAD: 2ff9bde) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/137175 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Gerrit User 21426:

Patch Set 3:

(3 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 12446:

Uploaded patch set 4: Commit message was updated.


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 5137:

Patch Set 4:

Cool, thanks! Rob, all yours now for the final approval and then we can submit it.


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 5015:

Patch Set 4:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR (HEAD: ba055cc) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/137175 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Gerrit User 21426:

Patch Set 5:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 21426:

Patch Set 5:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 21426:

Patch Set 5:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Daniel Martí:

Patch Set 5:

Brad/Ian, could you help us get Leigh's CL merged? I'm not familiar enough with the package to give the final +2.


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Brad Fitzpatrick:

Patch Set 5:

(5 comments)

Sorry, I'm kinda burned out on example CLs.


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR (HEAD: ba159b1) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/137175 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

This PR (HEAD: 7357bfd) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/137175 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Leigh McCulloch:

Patch Set 7:

(5 comments)

Patch Set 5:

(5 comments)

Sorry, I'm kinda burned out on example CLs.

Hey Brad, thanks for stepping in to review this. I addressed all the feedback.


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Rob Pike:

Patch Set 7:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Rob Pike:

Patch Set 7:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Rob Pike:

Patch Set 7: Code-Review+1

(1 comment)

LGTM. Leaving for Brad


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Emmanuel Odeke:

Patch Set 7: Run-TryBot+1

Patch Set 7: Code-Review+1

(1 comment)

LGTM. Leaving for Brad

Rob, thanks for the review. Brad just mentioned above that examples aren't currently his favorite to review so given your blessing with the +1, I'll ceremoniously submit it. Brad please feel free to revert.


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 7:

TryBots beginning. Status page: https://farmer.golang.org/try?commit=4c1aaa81


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 7:

Build is still in progress...
This change failed on linux-386:
See https://storage.googleapis.com/go-build-log/4c1aaa81/linux-386_23ec980a.log

Consult https://build.golang.org/ to see whether it's a new failure. Other builds still in progress; subsequent failure notices suppressed until final report.


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 7: TryBot-Result-1

3 of 19 TryBots failed:
Failed on linux-386: https://storage.googleapis.com/go-build-log/4c1aaa81/linux-386_23ec980a.log
Failed on js-wasm: https://storage.googleapis.com/go-build-log/4c1aaa81/js-wasm_f9bb39c3.log
Failed on windows-386-2008: https://storage.googleapis.com/go-build-log/4c1aaa81/windows-386-2008_bc8be68e.log

Consult https://build.golang.org/ to see whether they are new failures.


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Leigh McCulloch:

Patch Set 7:

Patch Set 7: TryBot-Result-1

3 of 19 TryBots failed:
Failed on linux-386: https://storage.googleapis.com/go-build-log/4c1aaa81/linux-386_23ec980a.log
Failed on js-wasm: https://storage.googleapis.com/go-build-log/4c1aaa81/js-wasm_f9bb39c3.log
Failed on windows-386-2008: https://storage.googleapis.com/go-build-log/4c1aaa81/windows-386-2008_bc8be68e.log

Consult https://build.golang.org/ to see whether they are new failures.

These failures look unrelated to this CL.


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Brad Fitzpatrick:

Patch Set 8: Patch Set 7 was rebased


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Brad Fitzpatrick:

Patch Set 8: Run-TryBot+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 8:

TryBots beginning. Status page: https://farmer.golang.org/try?commit=6e976c38


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 8: TryBot-Result+1

TryBots are happy.


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

gopherbot pushed a commit that referenced this pull request Nov 16, 2018
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: 7357bfd
GitHub-Pull-Request: #27840
Reviewed-on: https://go-review.googlesource.com/c/137175
Run-TryBot: Brad Fitzpatrick <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Brad Fitzpatrick <[email protected]>
Reviewed-by: Emmanuel Odeke <[email protected]>
@gopherbot
Copy link
Contributor

Message from Brad Fitzpatrick:

Patch Set 8: Code-Review+2


Please don’t reply on this GitHub thread. Visit golang.org/cl/137175.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR is being closed because golang.org/cl/137175 has been merged.

@gopherbot gopherbot closed this Nov 16, 2018
bradfitz pushed a commit that referenced this pull request Nov 21, 2018
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: 7357bfd
GitHub-Pull-Request: #27840
Reviewed-on: https://go-review.googlesource.com/c/137175
Run-TryBot: Brad Fitzpatrick <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Brad Fitzpatrick <[email protected]>
Reviewed-by: Emmanuel Odeke <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants