| 1 | package tasklogscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/ |
| 2 | |
| 3 | import ( |
| 4 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 5 | |
| 6 | "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/" |
| 7 | ) |
| 8 | |
| 9 | func TestWaitingTaskDisplaysWaitingStatusscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/TestWaitingTaskDisplaysWaitingStatus().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 10 | task := NewWaitingTaskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/NewWaitingTask().("example") |
| 11 | |
| 12 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "example: ...", (<-task.Updatesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/WaitingTask#Updates().()).Sscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Update#S.) |
| 13 | } |
| 14 | |
| 15 | func TestWaitingTaskCallsDoneWhenCompletescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/TestWaitingTaskCallsDoneWhenComplete().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 16 | task := NewWaitingTaskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/NewWaitingTask().("example") |
| 17 | |
| 18 | select { |
| 19 | case v, ok := <-task.Updatesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/WaitingTask#Updates().(): |
| 20 | if ok { |
| 21 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "example: ...", v.Sscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Update#S.) |
| 22 | } else { |
| 23 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("expected channel to be open") |
| 24 | } |
| 25 | default: |
| 26 | } |
| 27 | |
| 28 | task.Completescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/WaitingTask#Complete().() |
| 29 | |
| 30 | if _, ok := <-task.Updatesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/WaitingTask#Updates().(); ok { |
| 31 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("expected channel to be closed") |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | func TestWaitingTaskPanicsWithMultipleDoneCallsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/TestWaitingTaskPanicsWithMultipleDoneCalls().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 36 | task := NewWaitingTaskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/NewWaitingTask().("example") |
| 37 | |
| 38 | task.Completescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/WaitingTask#Complete().() |
| 39 | |
| 40 | defer func() { |
| 41 | if err := recover(); err == nil { |
| 42 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("tasklog: expected panic()") |
| 43 | } else { |
| 44 | if s, ok := err.(error); ok { |
| 45 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "close of closed channel", s.Error()) |
| 46 | } else { |
| 47 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("tasklog: expected panic() to implement error") |
| 48 | } |
| 49 | } |
| 50 | }() |
| 51 | |
| 52 | task.Completescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/WaitingTask#Complete().() |
| 53 | } |
| 54 | |
| 55 | func TestWaitingTaskIsThrottledscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/TestWaitingTaskIsThrottled().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 56 | task := NewWaitingTaskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/NewWaitingTask().("example") |
| 57 | |
| 58 | throttled := task.Throttledscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/WaitingTask#Throttled().() |
| 59 | |
| 60 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, throttled, |
| 61 | "tasklog: expected *WaitingTask to be Throttle()-d") |
| 62 | } |