MCPcopy Create free account
hub / github.com/go-task/task / TestAlphaNumericWithRootTasksFirst_Sort

Function TestAlphaNumericWithRootTasksFirst_Sort

internal/sort/sorter_test.go:9–49  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestAlphaNumericWithRootTasksFirst_Sort(t *testing.T) {
10 t.Parallel()
11
12 item1 := "a-item1"
13 item2 := "m-item2"
14 item3 := "ns1:item3"
15 item4 := "ns2:item4"
16 item5 := "z-item5"
17 item6 := "ns3:item6"
18
19 tests := []struct {
20 name string
21 items []string
22 want []string
23 }{
24 {
25 name: "no namespace items sorted alphabetically first",
26 items: []string{item3, item2, item1},
27 want: []string{item1, item2, item3},
28 },
29 {
30 name: "namespace items sorted alphabetically after non-namespaced items",
31 items: []string{item3, item4, item5},
32 want: []string{item5, item3, item4},
33 },
34 {
35 name: "all items sorted alphabetically with root items first",
36 items: []string{item6, item5, item4, item3, item2, item1},
37 want: []string{item1, item2, item5, item3, item4, item6},
38 },
39 }
40
41 for _, tt := range tests {
42 t.Run(tt.name, func(t *testing.T) {
43 t.Parallel()
44
45 AlphaNumericWithRootTasksFirst(tt.items, nil)
46 assert.Equal(t, tt.want, tt.items)
47 })
48 }
49}
50
51func TestAlphaNumeric_Sort(t *testing.T) {
52 t.Parallel()

Callers

nothing calls this directly

Calls 2

RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…