Compare commits
2 Commits
c326683ada
...
57b2d182c7
| Author | SHA1 | Date | |
|---|---|---|---|
| 57b2d182c7 | |||
| fb5a5ff38f |
@@ -491,7 +491,7 @@ func run(args []string, stdout, stderr io.Writer) int {
|
|||||||
func templateSplit(paths []string) string {
|
func templateSplit(paths []string) string {
|
||||||
for _, p := range paths {
|
for _, p := range paths {
|
||||||
if strings.Contains(p, "{") {
|
if strings.Contains(p, "{") {
|
||||||
return `; a template's spaces split the argument, so wrap the whole argument in "…"`
|
return `; a template's spaces split the argument, so wrap the whole argument in "…", or in '…' where it carries double quotes`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
|
|||||||
@@ -223,6 +223,14 @@ func TestRunMisuse(t *testing.T) {
|
|||||||
t.Errorf("run(%v) stdout = %q, want nothing", args, out)
|
t.Errorf("run(%v) stdout = %q, want nothing", args, out)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// A template a shell split names both quotings, since which one cures it turns
|
||||||
|
// on whether the argument carries a double-quoted JSON.
|
||||||
|
_, _, errb := runOut("{date(1990-01-01,2010-12-31,", "January", "2,", "2006)}")
|
||||||
|
for _, want := range []string{`wrap the whole argument in "…"`, `or in '…'`} {
|
||||||
|
if !strings.Contains(errb, want) {
|
||||||
|
t.Errorf("a split template stderr = %q, want it to name %s", errb, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunMultipleDataPaths(t *testing.T) {
|
func TestRunMultipleDataPaths(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user