From 3831b5eae27e0b196205842ca67245083a642e48 Mon Sep 17 00:00:00 2001 From: Dana Woodman Date: Tue, 27 Feb 2024 10:31:21 -0800 Subject: [PATCH] Fix stdout separator --- test/e2e_test.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/test/e2e_test.go b/test/e2e_test.go index 6588c26..6472a81 100644 --- a/test/e2e_test.go +++ b/test/e2e_test.go @@ -68,7 +68,7 @@ func TestCng(t *testing.T) { write(".git/foo.txt") write("node_modules/foo.txt") }, - stdout: []string{""}, + stdout: []string{}, }, // todo: should report helpful error if missing pattern // { @@ -149,13 +149,16 @@ func TestCng(t *testing.T) { stdout := stdoutBuf.String() stderr := stderrBuf.String() - var sep string - if runtime.GOOS == "windows" { - sep = "\r" - } else { - sep = "\n" + var testStdout string + if len(test.stdout) > 0 { + var sep string + if runtime.GOOS == "windows" { + sep = "\r" + } else { + sep = "\n" + } + testStdout = strings.Join(test.stdout, sep) + sep } - testStdout := strings.Join(test.stdout, sep) assert.Equal(t, testStdout, stdout) assert.Equal(t, test.stderr, stderr) })