This commit is contained in:
@@ -52,6 +52,9 @@ func ParsePost(line string, date time.Time, prev models.Post) (models.Post, erro
|
||||
|
||||
if line[tsEndIndex+2] == '*' {
|
||||
split := strings.SplitN(line[tsEndIndex+4:], " ", 2)
|
||||
if len(split) == 1 {
|
||||
return models.Post{}, ErrNotPost
|
||||
}
|
||||
|
||||
post := models.Post{
|
||||
ID: "UNASSIGNED",
|
||||
@@ -70,6 +73,9 @@ func ParsePost(line string, date time.Time, prev models.Post) (models.Post, erro
|
||||
return post, nil
|
||||
} else if line[tsEndIndex+2] == '<' {
|
||||
split := strings.SplitN(line[tsEndIndex+2:], " ", 2)
|
||||
if len(split) == 1 {
|
||||
return models.Post{}, ErrNotPost
|
||||
}
|
||||
|
||||
post := models.Post{
|
||||
ID: "UNASSIGNED",
|
||||
|
||||
@@ -71,6 +71,10 @@ func TestParsePostErrors(t *testing.T) {
|
||||
{"[10] <Stuff> Things said.", mirclike.ErrNotPost},
|
||||
{"[12:34:56:789] <Stuff> Things said.", nil},
|
||||
{"[12:34:56.789] <Stuff> Things said.", mirclike.ErrNotPost},
|
||||
{"[12:34] <Stuff>", mirclike.ErrNotPost},
|
||||
{"[12:34] * Stuff", mirclike.ErrNotPost},
|
||||
{"[12:34] =Scene=", mirclike.ErrNotPost},
|
||||
{"[12:34] <=Scene=>", mirclike.ErrNotPost},
|
||||
}
|
||||
|
||||
for i, row := range table {
|
||||
|
||||
Reference in New Issue
Block a user