| 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 | "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/" |
| 8 | ) |
| 9 | |
| 10 | func TestSimpleTaskLogLogsUpdatesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/TestSimpleTaskLogLogsUpdates().(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#) { |
| 11 | task := NewSimpleTaskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/NewSimpleTask().() |
| 12 | |
| 13 | var updates []*Updatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Update# |
| 14 | |
| 15 | go func() { |
| 16 | for update := range task.Updatesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/SimpleTask#Updates().() { |
| 17 | updates = append(updates, update) |
| 18 | } |
| 19 | task.OnCompletescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/SimpleTask#OnComplete().() |
| 20 | }() |
| 21 | |
| 22 | task.Logscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/SimpleTask#Log().("Hello, world") |
| 23 | task.Completescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/SimpleTask#Complete().() |
| 24 | |
| 25 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Lenscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Len().(t, updates, 1) |
| 26 | 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, "Hello, world", updates[0].Sscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Update#S.) |
| 27 | } |
| 28 | |
| 29 | func TestSimpleTaskLogfLogsFormattedUpdatesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/TestSimpleTaskLogfLogsFormattedUpdates().(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#) { |
| 30 | task := NewSimpleTaskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/NewSimpleTask().() |
| 31 | |
| 32 | var updates []*Updatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Update# |
| 33 | |
| 34 | go func() { |
| 35 | for update := range task.Updatesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/SimpleTask#Updates().() { |
| 36 | updates = append(updates, update) |
| 37 | } |
| 38 | task.OnCompletescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/SimpleTask#OnComplete().() |
| 39 | }() |
| 40 | |
| 41 | task.Logfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/SimpleTask#Logf().("Hello, world (%d)", 3+4) |
| 42 | task.Completescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/SimpleTask#Complete().() |
| 43 | |
| 44 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Lenscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Len().(t, updates, 1) |
| 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, "Hello, world (7)", updates[0].Sscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Update#S.) |
| 46 | } |
| 47 | |
| 48 | func TestSimpleTaskCompleteClosesUpdatesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/TestSimpleTaskCompleteClosesUpdates().(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#) { |
| 49 | task := NewSimpleTaskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/NewSimpleTask().() |
| 50 | |
| 51 | select { |
| 52 | case <-task.Updatesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/SimpleTask#Updates().(): |
| 53 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("tasklog: unexpected update from *SimpleTask") |
| 54 | default: |
| 55 | } |
| 56 | |
| 57 | go func() { |
| 58 | <-task.Updatesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/SimpleTask#Updates().() |
| 59 | task.OnCompletescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/SimpleTask#OnComplete().() |
| 60 | }() |
| 61 | |
| 62 | task.Completescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/SimpleTask#Complete().() |
| 63 | |
| 64 | if _, ok := <-task.Updatesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/SimpleTask#Updates().(); ok { |
| 65 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("tasklog: expected (*SimpleTask).Updates() to be closed") |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | func TestSimpleTaskIsNotThrottledscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/TestSimpleTaskIsNotThrottled().(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#) { |
| 70 | task := NewSimpleTaskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/NewSimpleTask().() |
| 71 | |
| 72 | throttled := task.Throttledscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/SimpleTask#Throttled().() |
| 73 | |
| 74 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/False().(t, throttled, |
| 75 | "tasklog: expected *SimpleTask not to be Throttle()-d") |
| 76 | } |