Market import: read "-url:" typed without a space after the dash

A hand-typed list with no space after its dashes was an error about a
key defined twice. It's now read as meant; a list that still can't be
read says what an entry looks like.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 06:50:00 -07:00
co-authored by Claude Opus 5.5
parent 4692d72d58
commit 32d69c4a80
2 changed files with 42 additions and 8 deletions
+13
View File
@@ -33,6 +33,19 @@ func TestParseYAMLWebsiteOnly(t *testing.T) {
}
}
func TestParseYAMLDashWithoutSpace(t *testing.T) {
doc := "inventory:\n-url: https://listmonk.app/\n-url: https://matomo.org/\n relationship: competitor\n"
entries, err := ParseYAML([]byte(doc), Partner)
if err != nil || len(entries) != 2 || entries[0].Websites[0] != "https://listmonk.app/" ||
entries[0].Relationship != Partner || entries[1].Relationship != Competitor {
t.Fatalf("%+v %v", entries, err)
}
// Still not a list: the error says what one looks like.
if _, err := ParseYAML([]byte("inventory:\n url: [\n"), Partner); err == nil || !strings.Contains(err.Error(), "a dash and a space") {
t.Errorf("error: %v", err)
}
}
func testDB(t *testing.T) *db.DB {
t.Helper()
d, err := db.Open(filepath.Join(t.TempDir(), "app.db"))