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:
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user