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

Function TestAppendParagraph

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

Source from the content-addressed store, hash-verified

540}
541
542func TestAppendParagraph(t *testing.T) {
543 tests := []struct {
544 name string
545 md string
546 addition string
547 want string
548 }{
549 {name: "separates with a blank line", md: "text", addition: "more", want: "text\n\nmore"},
550 {name: "empty markdown", md: "", addition: "more", want: "more"},
551 {name: "whitespace only markdown", md: " \n\n", addition: "more", want: "more"},
552 {name: "empty addition preserves markdown", md: "text \n", addition: "", want: "text \n"},
553 {name: "trailing newlines", md: "text\n\n\n", addition: "more", want: "text\n\nmore"},
554 {name: "trailing spaces", md: "text ", addition: "more", want: "text\n\nmore"},
555 }
556
557 for _, tt := range tests {
558 t.Run(tt.name, func(t *testing.T) {
559 assert.Equal(t, tt.want, appendParagraph(tt.md, tt.addition))
560 })
561 }
562}
563
564func TestUploaderUploadAndAttachDoesNotLeakTheAssetURLIntoAnError(t *testing.T) {
565 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