|
|
@ -92,7 +92,6 @@ func TestMircPostNextDay(t *testing.T) { |
|
|
|
Time time.Time |
|
|
|
}{ |
|
|
|
{Prev: parseDate(t, "2019-01-12 12:00:00"), TS: "12:01", Time: parseDate(t, "2019-01-12 12:01:00")}, |
|
|
|
{Prev: parseDate(t, "2019-01-12 12:00:00"), TS: "11:53:13", Time: parseDate(t, "2019-01-12 11:53:13")}, |
|
|
|
{Prev: parseDate(t, "2019-04-08 23:51:59"), TS: "00:09", Time: parseDate(t, "2019-04-09 00:09:00")}, |
|
|
|
{Prev: parseDate(t, "2019-01-12 12:00:00"), TS: "11:29:59", Time: parseDate(t, "2019-01-13 11:29:59")}, |
|
|
|
} |
|
|
@ -111,6 +110,41 @@ func TestMircPostNextDay(t *testing.T) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func TestMircPostDayPerPostBug(t *testing.T) { |
|
|
|
startDate := parseDate(t, "2019-07-20 23:25:00") |
|
|
|
table := []struct { |
|
|
|
TS string |
|
|
|
Time time.Time |
|
|
|
}{ |
|
|
|
{TS: "23:25", Time: parseDate(t, "2019-07-20 23:25:00")}, |
|
|
|
{TS: "23:45", Time: parseDate(t, "2019-07-20 23:45:00")}, |
|
|
|
{TS: "23:59", Time: parseDate(t, "2019-07-20 23:59:00")}, |
|
|
|
{TS: "00:00", Time: parseDate(t, "2019-07-21 00:00:00")}, |
|
|
|
{TS: "00:03", Time: parseDate(t, "2019-07-21 00:03:00")}, |
|
|
|
{TS: "00:06", Time: parseDate(t, "2019-07-21 00:06:00")}, |
|
|
|
{TS: "12:00", Time: parseDate(t, "2019-07-21 12:00:00")}, |
|
|
|
{TS: "22:00", Time: parseDate(t, "2019-07-21 22:00:00")}, |
|
|
|
{TS: "23:55", Time: parseDate(t, "2019-07-21 23:55:00")}, |
|
|
|
{TS: "00:05", Time: parseDate(t, "2019-07-22 00:05:00")}, |
|
|
|
} |
|
|
|
|
|
|
|
prev := startDate |
|
|
|
for i, row := range table { |
|
|
|
t.Run(fmt.Sprintf("Row_%d", i), func(t *testing.T) { |
|
|
|
input := fmt.Sprintf("[%s] * Test post content.", row.TS) |
|
|
|
|
|
|
|
post, err := parsers.MircPost(input, startDate, models.Post{Time: prev}) |
|
|
|
if err != nil { |
|
|
|
t.Fatal("Could not parse post:", err) |
|
|
|
} |
|
|
|
|
|
|
|
prev = post.Time |
|
|
|
|
|
|
|
assert.Equal(t, row.Time, post.Time) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func TestMircLog(t *testing.T) { |
|
|
|
parsed, err := parsers.MircLog(testLog, parseDate(t, "2018-05-11 00:00:00"), false) |
|
|
|
if err != nil { |
|
|
|