mirror of
https://github.com/miniflux/v2.git
synced 2025-08-31 18:31:01 +00:00
Ensure that LocalizedError are returned by parsers
This commit is contained in:
parent
557cf9c21d
commit
0e6717b7c8
15 changed files with 71 additions and 30 deletions
|
@ -8,6 +8,8 @@ import (
|
|||
"bytes"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/miniflux/miniflux2/errors"
|
||||
)
|
||||
|
||||
func TestParseAtomSample(t *testing.T) {
|
||||
|
@ -317,3 +319,15 @@ func TestParseEntryWithEnclosures(t *testing.T) {
|
|||
t.Errorf("Incorrect enclosure length, got: %d", feed.Entries[0].Enclosures[1].Size)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseInvalidXml(t *testing.T) {
|
||||
data := `garbage`
|
||||
_, err := Parse(bytes.NewBufferString(data))
|
||||
if err == nil {
|
||||
t.Error("Parse should returns an error")
|
||||
}
|
||||
|
||||
if _, ok := err.(errors.LocalizedError); !ok {
|
||||
t.Error("The error returned must be a LocalizedError")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue