delve/cmd/dlv/cmds/commands_test.go
Alessandro Arzilli 5d78c04e62 dlv: bugfix: Allow quoting in build flags argument (#639)
Allows quoted substrings in build-flags flag. This fixes a build
problem on windows where the default build flags must contain a space.

Fixes #634 and #638
2016-09-25 08:26:59 -07:00

22 lines
479 B
Go

package cmds
import (
"testing"
)
func TestSplitQuotedFields(t *testing.T) {
in := `field'A' 'fieldB' fie'l\'d'C fieldD 'another field' fieldE`
tgt := []string{"fieldA", "fieldB", "fiel'dC", "fieldD", "another field", "fieldE"}
out := splitQuotedFields(in)
if len(tgt) != len(out) {
t.Fatalf("expected %#v, got %#v (len mismatch)", tgt, out)
}
for i := range tgt {
if tgt[i] != out[i] {
t.Fatalf(" expected %#v, got %#v (mismatch at %d)", tgt, out, i)
}
}
}