Fixed command executer test

This commit is contained in:
edwardro22
2018-01-22 18:37:37 +02:00
committed by Dan Christian Bogos
parent 89a181bf12
commit 73db1aeff4
2 changed files with 4 additions and 4 deletions

View File

@@ -107,9 +107,9 @@ func (ce *CommandExecuter) LocalExecute() string {
}
func ToJSON(line string) (jsn []byte) {
// if !strings.Contains(line, "=") {
// line = fmt.Sprintf("Item=\"%s\"", line)
// }
if !strings.Contains(line, "=") && line != "" {
line = fmt.Sprintf("Item=\"%s\"", line)
}
jsn = append(jsn, '{')
for _, group := range lineR.FindAllStringSubmatch(line, -1) {
if len(group) == 3 {

View File

@@ -40,7 +40,7 @@ func TestToJSONValid(t *testing.T) {
func TestToJSONEmpty(t *testing.T) {
jsn := ToJSON("")
if string(jsn) != `{"Item":""}` {
if string(jsn) != `{}` {
t.Error("Error empty: ", string(jsn))
}
}