MCPcopy Index your code
hub / github.com/expr-lang/expr / TestSortValuesWithSpew

Function TestSortValuesWithSpew

internal/spew/common_test.go:268–298  ·  view source on GitHub ↗

TestSortValuesWithSpew ensures the sort functionality for reflect.Value based sorting works as intended when using spew to stringify keys.

(t *testing.T)

Source from the content-addressed store, hash-verified

266// TestSortValuesWithSpew ensures the sort functionality for reflect.Value
267// based sorting works as intended when using spew to stringify keys.
268func TestSortValuesWithSpew(t *testing.T) {
269 v := reflect.ValueOf
270
271 a := v("a")
272 b := v("b")
273 c := v("c")
274 tests := []sortTestCase{
275 // Ints.
276 {
277 []reflect.Value{v(2), v(1), v(3)},
278 []reflect.Value{v(1), v(2), v(3)},
279 },
280 // Strings.
281 {
282 []reflect.Value{b, a, c},
283 []reflect.Value{a, b, c},
284 },
285 // SortableStructs.
286 {
287 []reflect.Value{v(sortableStruct{2}), v(sortableStruct{1}), v(sortableStruct{3})},
288 []reflect.Value{v(sortableStruct{1}), v(sortableStruct{2}), v(sortableStruct{3})},
289 },
290 // UnsortableStructs.
291 {
292 []reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})},
293 []reflect.Value{v(unsortableStruct{1}), v(unsortableStruct{2}), v(unsortableStruct{3})},
294 },
295 }
296 cs := spew.ConfigState{DisableMethods: true, SpewKeys: true}
297 helpTestSortValues(tests, &cs, t)
298}

Callers

nothing calls this directly

Calls 1

helpTestSortValuesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…