Tests: template misuse exits 2, and a bare token hints its reference spelling

This commit is contained in:
2026-09-03 19:21:42 +02:00
parent 305d8f8edd
commit 4d58c93757
2 changed files with 22 additions and 0 deletions
+14
View File
@@ -333,6 +333,20 @@ func TestRunInlineTemplate(t *testing.T) {
}
}
func TestRunTemplateMisuse(t *testing.T) {
for _, arg := range []string{
"{bad", // unterminated brace
"[red,green]", // a near-miss JSON array (unquoted strings)
`{"format":"x"}`, // an object holding only a format
"{/no.such.path}", // a reference into nothing
} {
code, out, errb := runOut("--seed", "1", arg)
if code != 2 || out != "" || !strings.Contains(errb, "try 'fejkdata --help'") {
t.Errorf("run(%q) = %d, %q, %q; want misuse naming --help", arg, code, out, errb)
}
}
}
func TestRunNoShippedData(t *testing.T) {
code, list, errb := runOut("--no-shipped-data", "-d", svSE, "--list")
if code != 0 {