MCPcopy Create free account
hub / github.com/cli/cli / TestAppendParagraph

Function TestAppendParagraph

internal/attachments/attach_test.go:263–283  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

261}
262
263func TestAppendParagraph(t *testing.T) {
264 tests := []struct {
265 name string
266 md string
267 addition string
268 want string
269 }{
270 {name: "separates with a blank line", md: "text", addition: "more", want: "text\n\nmore"},
271 {name: "empty markdown", md: "", addition: "more", want: "more"},
272 {name: "whitespace only markdown", md: " \n\n", addition: "more", want: "more"},
273 {name: "empty addition preserves markdown", md: "text \n", addition: "", want: "text \n"},
274 {name: "trailing newlines", md: "text\n\n\n", addition: "more", want: "text\n\nmore"},
275 {name: "trailing spaces", md: "text ", addition: "more", want: "text\n\nmore"},
276 }
277
278 for _, tt := range tests {
279 t.Run(tt.name, func(t *testing.T) {
280 assert.Equal(t, tt.want, appendParagraph(tt.md, tt.addition))
281 })
282 }
283}
284
285func TestUploaderUploadAndAttachDoesNotLeakTheAssetURLIntoAnError(t *testing.T) {
286 writeFiles(t, "a.png", "b.png")

Callers

nothing calls this directly

Calls 3

appendParagraphFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected