Merge "Fix TestExternalShellEscaping and TestExternalShellEscapeIncludingSpaces on darwin" into main am: e1d71ae428

Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2878400

Change-Id: Iec29daefb5abdf1ed561a6ba566cbdc936b681de
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2023-12-18 20:11:53 +00:00 committed by Automerger Merge Worker
commit 083f69bbcd

View file

@ -15,6 +15,7 @@
package proptools
import (
"bytes"
"os/exec"
"reflect"
"testing"
@ -143,8 +144,9 @@ func TestExternalShellEscaping(t *testing.T) {
return
}
for _, testCase := range shellEscapeTestCase {
cmd := "echo -n " + ShellEscape(testCase.in)
cmd := "echo " + ShellEscape(testCase.in)
got, err := exec.Command("/bin/sh", "-c", cmd).Output()
got = bytes.TrimSuffix(got, []byte("\n"))
if err != nil {
t.Error(err)
}
@ -159,8 +161,9 @@ func TestExternalShellEscapeIncludingSpaces(t *testing.T) {
return
}
for _, testCase := range shellEscapeIncludingSpacesTestCase {
cmd := "echo -n " + ShellEscapeIncludingSpaces(testCase.in)
cmd := "echo " + ShellEscapeIncludingSpaces(testCase.in)
got, err := exec.Command("/bin/sh", "-c", cmd).Output()
got = bytes.TrimSuffix(got, []byte("\n"))
if err != nil {
t.Error(err)
}