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

Function TestAppendParagraph

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

Source from the content-addressed store, hash-verified

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