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

Function TestSingleLineFieldValue

pkg/cmd/project/shared/queries/queries_test.go:851–869  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

849}
850
851func TestSingleLineFieldValue(t *testing.T) {
852 tests := []struct {
853 name string
854 in string
855 want string
856 }{
857 {name: "no line breaks", in: "plain", want: "plain"},
858 {name: "newline becomes space", in: "a\nb", want: "a b"},
859 {name: "CRLF becomes a single space", in: "a\r\nb", want: "a b"},
860 {name: "lone carriage return is dropped", in: "a\rb", want: "ab"},
861 {name: "consecutive newlines", in: "a\n\nb", want: "a b"},
862 }
863
864 for _, tt := range tests {
865 t.Run(tt.name, func(t *testing.T) {
866 assert.Equal(t, tt.want, singleLineFieldValue(tt.in))
867 })
868 }
869}

Callers

nothing calls this directly

Calls 3

singleLineFieldValueFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected