chore: add example
parent
bcc2054da6
commit
7afd658200
9
Makefile
9
Makefile
|
@ -1,13 +1,14 @@
|
|||
.PHONY: all test-color lint try-4-real
|
||||
|
||||
all: test-color lint try-4-real
|
||||
all: test-color lint
|
||||
go mod tidy
|
||||
|
||||
test-color:
|
||||
go install github.com/haunt98/go-test-color@latest
|
||||
go-test-color -race -failfast ./...
|
||||
go-test-color -race -failfast .
|
||||
|
||||
lint:
|
||||
golangci-lint run ./...
|
||||
golangci-lint run .
|
||||
|
||||
try-4-real:
|
||||
go run .
|
||||
go run . -race ./example/...
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package example
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
const longTime = time.Second * 2
|
||||
|
||||
func TestPassShortTime(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPassLongTime(t *testing.T) {
|
||||
time.Sleep(longTime)
|
||||
}
|
||||
|
||||
func TestFailShorTime(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
func TestFailLongTime(t *testing.T) {
|
||||
time.Sleep(longTime)
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
func TestFailShorTimeParallel(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
func TestFailLongTimeParallel(t *testing.T) {
|
||||
t.Parallel()
|
||||
time.Sleep(longTime)
|
||||
t.Fail()
|
||||
}
|
Loading…
Reference in New Issue