MCPcopy Index your code
hub / github.com/docker/cli / TestEllipsis

Function TestEllipsis

cli/command/formatter/displayutils_test.go:53–74  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

51}
52
53func TestEllipsis(t *testing.T) {
54 testcases := []struct {
55 source string
56 width int
57 expected string
58 }{
59 {source: "t🐳ststring", width: 0, expected: ""},
60 {source: "t🐳ststring", width: 1, expected: "t"},
61 {source: "t🐳ststring", width: 2, expected: "t…"},
62 {source: "t🐳ststring", width: 6, expected: "t🐳st…"},
63 {source: "t🐳ststring", width: 20, expected: "t🐳ststring"},
64 {source: "你好世界teststring", width: 0, expected: ""},
65 {source: "你好世界teststring", width: 1, expected: "你"},
66 {source: "你好世界teststring", width: 3, expected: "你…"},
67 {source: "你好世界teststring", width: 6, expected: "你好…"},
68 {source: "你好世界teststring", width: 20, expected: "你好世界teststring"},
69 }
70
71 for _, testcase := range testcases {
72 assert.Check(t, is.Equal(testcase.expected, Ellipsis(testcase.source, testcase.width)))
73 }
74}

Callers

nothing calls this directly

Calls 1

EllipsisFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…