mirror of
https://github.com/Fishwaldo/go-taskmanager.git
synced 2025-03-15 11:21:28 +00:00
Remove Empty Test
This commit is contained in:
parent
dafce5cbd9
commit
0b57089422
2 changed files with 3 additions and 113 deletions
4
.github/workflows/lint.yml
vendored
4
.github/workflows/lint.yml
vendored
|
@ -9,6 +9,8 @@ jobs:
|
|||
uses: actions/checkout@v1
|
||||
|
||||
- name: GolangCI-Lint Action
|
||||
uses: matoous/golangci-lint-action@v1.23.3
|
||||
uses: matoous/golangci-lint-action@v2
|
||||
with:
|
||||
config: .golangci.yml
|
||||
version: latest
|
||||
only-new-issues: true
|
||||
|
|
112
job/job_test.go
112
job/job_test.go
|
@ -1,112 +0,0 @@
|
|||
// //nolint
|
||||
// package job
|
||||
|
||||
// import (
|
||||
// "context"
|
||||
// "errors"
|
||||
// "testing"
|
||||
// "time"
|
||||
|
||||
// )
|
||||
|
||||
// func TestErrorJobPanic_Error(t *testing.T) {
|
||||
// want := "panic text"
|
||||
// e := ErrorJobPanic{want}
|
||||
// if got := e.Error(); got != want {
|
||||
// t.Errorf("Error() = %v, want %v", got, want)
|
||||
// }
|
||||
// }
|
||||
|
||||
// func TestErrorJobStarted_Error(t *testing.T) {
|
||||
// want := "panic text"
|
||||
// e := ErrorJobPanic{want}
|
||||
// if got := e.Error(); got != want {
|
||||
// t.Errorf("Error() = %v, want %v", got, want)
|
||||
// }
|
||||
// }
|
||||
|
||||
// func TestJob_ActualElapsed(t *testing.T) {
|
||||
|
||||
// timeWait := 1 * time.Second
|
||||
// ctx := context.Background()
|
||||
// j := NewJob(ctx, func(context.Context) {
|
||||
// time.Sleep(timeWait)
|
||||
// })
|
||||
|
||||
// j.Run()
|
||||
|
||||
// want := timeWait
|
||||
// got := j.ActualElapsed().Round(1 * time.Second)
|
||||
// if got != want {
|
||||
// t.Errorf("Actual Elapsed Time not accurate, want %v, got %v", want, got)
|
||||
// }
|
||||
// }
|
||||
|
||||
// func TestJob_TotalElapsed(t *testing.T) {
|
||||
// timeWait := 1 * time.Second
|
||||
|
||||
// ctx := context.Background()
|
||||
// j := NewJob(ctx, func(context.Context) {
|
||||
// time.Sleep(timeWait)
|
||||
// })
|
||||
// time.Sleep(timeWait)
|
||||
|
||||
// j.Run()
|
||||
|
||||
// want := timeWait * 2
|
||||
// got := j.TotalElapsed().Round(1 * time.Second)
|
||||
// if got != want {
|
||||
// t.Errorf("Total Elapsed Time not accurate, want %v, got %v", want, got)
|
||||
// }
|
||||
// }
|
||||
|
||||
// func TestJob_ID(t *testing.T) {
|
||||
// want := "idxxx"
|
||||
// j := &Job{
|
||||
// id: want,
|
||||
// }
|
||||
// if got := j.ID(); got != want {
|
||||
// t.Errorf("ID() = %v, want %v", got, want)
|
||||
// }
|
||||
// }
|
||||
|
||||
// func TestJob_Run(t *testing.T) {
|
||||
|
||||
// receiveChan := make(chan string)
|
||||
// ctx := context.Background()
|
||||
// receiveWant := "testx"
|
||||
// j := NewJob(ctx, func(context.Context) {
|
||||
// receiveChan <- receiveWant
|
||||
// })
|
||||
|
||||
// go j.Run()
|
||||
|
||||
// select {
|
||||
// case got := <-receiveChan:
|
||||
// if got != receiveWant {
|
||||
// t.Errorf("Job Run but got unexpcted result, want %v, got %v", receiveWant, got)
|
||||
// }
|
||||
// case <-time.After(5 * time.Second):
|
||||
// t.Errorf("job didn't run [timeout]")
|
||||
// }
|
||||
// }
|
||||
|
||||
// func TestJob_RunPanicRecover(t *testing.T) {
|
||||
|
||||
// ctx := context.Background()
|
||||
// j := NewJob(ctx, func(context.Context) {
|
||||
// panic("panicked")
|
||||
// })
|
||||
|
||||
// err := j.Run()
|
||||
// if err == nil {
|
||||
// t.Error("Job panicked and returned no error.")
|
||||
// return
|
||||
// }
|
||||
|
||||
// ref := ErrorJobPanic{"example error"}
|
||||
|
||||
// if !errors.As(err, &ref) {
|
||||
// t.Error("Job panicked and handled but returned different error type.")
|
||||
// }
|
||||
// }
|
Loading…
Add table
Reference in a new issue