MCPcopy
hub / github.com/go-task/task / TestAlphaNumeric_Sort

Function TestAlphaNumeric_Sort

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

Source from the content-addressed store, hash-verified

49}
50
51func TestAlphaNumeric_Sort(t *testing.T) {
52 t.Parallel()
53
54 item1 := "a-item1"
55 item2 := "m-item2"
56 item3 := "ns1:item3"
57 item4 := "ns2:item4"
58 item5 := "z-item5"
59 item6 := "ns3:item6"
60
61 tests := []struct {
62 name string
63 items []string
64 want []string
65 }{
66 {
67 name: "all items sorted alphabetically",
68 items: []string{item3, item2, item5, item1, item4, item6},
69 want: []string{item1, item2, item3, item4, item6, item5},
70 },
71 }
72
73 for _, tt := range tests {
74 t.Run(tt.name, func(t *testing.T) {
75 t.Parallel()
76
77 AlphaNumeric(tt.items, nil)
78 assert.Equal(t, tt.want, tt.items)
79 })
80 }
81}
82
83func TestNoSort_Sort(t *testing.T) {
84 t.Parallel()

Callers

nothing calls this directly

Calls 2

AlphaNumericFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…