chore: add example

main
sudo pacman -Syu 2022-08-13 17:06:54 +07:00
parent bcc2054da6
commit 7afd658200
No known key found for this signature in database
GPG Key ID: D6CB5C6C567C47B0
2 changed files with 40 additions and 4 deletions

View File

@ -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/...

35
example/example_test.go Normal file
View File

@ -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()
}