MCPcopy
hub / github.com/kubernetes/kubectl / TestFormatterWrite

Function TestFormatterWrite

pkg/explain/formatter_test.go:26–46  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24)
25
26func TestFormatterWrite(t *testing.T) {
27 buf := bytes.Buffer{}
28 f := Formatter{
29 Writer: &buf,
30 }
31
32 f.Write("Lorem ipsum dolor sit amet, consectetur adipiscing elit.")
33 // Indent creates a new Formatter
34 f.Indent(5).Write("Morbi at turpis faucibus, gravida dolor ut, fringilla velit.")
35 // So Indent(2) doesn't indent to 7 here.
36 f.Indent(2).Write("Etiam maximus urna at tellus faucibus mattis.")
37
38 want := `Lorem ipsum dolor sit amet, consectetur adipiscing elit.
39 Morbi at turpis faucibus, gravida dolor ut, fringilla velit.
40 Etiam maximus urna at tellus faucibus mattis.
41`
42
43 if buf.String() != want {
44 t.Errorf("Got:\n%v\nWant:\n%v\n", buf.String(), want)
45 }
46}
47
48func TestFormatterWrappedWrite(t *testing.T) {
49 buf := bytes.Buffer{}

Callers

nothing calls this directly

Calls 4

WriteMethod · 0.95
IndentMethod · 0.95
WriteMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…