MCPcopy
hub / github.com/go-task/task / TestNormalizeOutput

Function TestNormalizeOutput

task_test.go:336–357  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

334}
335
336func TestNormalizeOutput(t *testing.T) {
337 t.Parallel()
338 tests := []struct {
339 name string
340 input []byte
341 expected []byte
342 }{
343 {"CRLF to LF", []byte("line1\r\nline2\r\n"), []byte("line1\nline2\n")},
344 {"CR to LF", []byte("line1\rline2\r"), []byte("line1\nline2\n")},
345 {"Windows path", []byte(`D:\a\task\task`), []byte(`D:/a/task/task`)},
346 {"JSON escaped backslash", []byte(`{"path":"D:\\a\\task"}`), []byte(`{"path":"D:/a/task"}`)},
347 {"Mixed", []byte("D:\\a\\task\r\n"), []byte("D:/a/task\n")},
348 {"Unix path unchanged", []byte("/home/user/task\n"), []byte("/home/user/task\n")},
349 }
350 for _, tt := range tests {
351 t.Run(tt.name, func(t *testing.T) {
352 t.Parallel()
353 got := normalizeOutput(tt.input)
354 assert.Equal(t, tt.expected, got)
355 })
356 }
357}
358
359func TestNormalizePathSeparators(t *testing.T) {
360 t.Parallel()

Callers

nothing calls this directly

Calls 2

normalizeOutputFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…