MCPcopy Index your code
hub / github.com/coder/coder / TestHasSuspiciousTrailingNewline

Function TestHasSuspiciousTrailingNewline

cli/secret_internal_test.go:15–37  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestHasSuspiciousTrailingNewline(t *testing.T) {
16 t.Parallel()
17
18 tests := []struct {
19 name string
20 input string
21 suspicious bool
22 }{
23 {name: "NoTrailingNewline", input: "token", suspicious: false},
24 {name: "SingleTrailingLF", input: "token\n", suspicious: true},
25 {name: "SingleTrailingCRLF", input: "token\r\n", suspicious: true},
26 {name: "SingleTrailingCR", input: "token\r", suspicious: true},
27 {name: "MultilineValue", input: "line1\nline2\n", suspicious: false},
28 }
29
30 for _, tt := range tests {
31 t.Run(tt.name, func(t *testing.T) {
32 t.Parallel()
33
34 require.Equal(t, tt.suspicious, hasSuspiciousTrailingNewline(tt.input))
35 })
36 }
37}
38
39func TestReadInvocationStdin(t *testing.T) {
40 t.Parallel()

Callers

nothing calls this directly

Calls 3

RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected