Test blank stdin rendering, a category reading itself as a fresh draw, a bare number or boolean refused in a record column, a one-item choice of weight 0 refused, and a hidden rows file read

This commit is contained in:
2026-10-08 11:48:08 +02:00
committed by Lillem4n
parent 66509abf1e
commit dd09d7ae82
6 changed files with 62 additions and 27 deletions
+3 -5
View File
@@ -220,8 +220,6 @@ func TestRunMisuse(t *testing.T) {
stdin string
args []string
}{
{"", nil},
{"", []string{"--data-path", svSE}},
{"{/person}", []string{"-d", svSE, "word"}},
{"", []string{"-d", svSE, "--list", "person"}},
{"{/sv_SE.person}", []string{"--no-shipped-data"}},
@@ -313,10 +311,10 @@ func TestRunRendersExactlyWhatIsSent(t *testing.T) {
}
}
func TestRunRefusesBlankStdin(t *testing.T) {
func TestRunRendersBlankStdin(t *testing.T) {
for _, stdin := range []string{"", "\n", " \r\n\t"} {
if code, out, errb := runOut(stdin); code != 2 || out != "" || !strings.Contains(errb, "holds no template") {
t.Errorf("run(%q) = %d, %q, %q; want misuse naming the empty stdin", stdin, code, out, errb)
if code, out, errb := runOut(stdin); code != 0 || out != stdin {
t.Errorf("run(%q) = %d, %q, %q; want the blank template rendered as it is", stdin, code, out, errb)
}
}
}