mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-03-10 18:58:17 +00:00
Update cheatsheets
This commit is contained in:
33
go-test
Normal file
33
go-test
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, common]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# go test
|
||||
|
||||
> Tests Go packages (files have to end with `_test.go`).
|
||||
> More information: <https://golang.org/cmd/go/#hdr-Testing_flags>.
|
||||
|
||||
- Test the package found in the current directory:
|
||||
|
||||
`go test`
|
||||
|
||||
- [v]erbosely test the package in the current directory:
|
||||
|
||||
`go test -v`
|
||||
|
||||
- Test the packages in the current directory and all subdirectories (note the `...`):
|
||||
|
||||
`go test -v ./...`
|
||||
|
||||
- Test the package in the current directory and run all benchmarks:
|
||||
|
||||
`go test -v -bench .`
|
||||
|
||||
- Test the package in the current directory and run all benchmarks for 50 seconds:
|
||||
|
||||
`go test -v -bench . -benchtime {{50s}}`
|
||||
|
||||
- Test the package with coverage analysis:
|
||||
|
||||
`go test -cover`
|
||||
Reference in New Issue
Block a user