diff options
author | Evgeny Kuznetsov <evgeny@kuznetsov.md> | 2020-02-05 19:51:43 +0300 |
---|---|---|
committer | Evgeny Kuznetsov <evgeny@kuznetsov.md> | 2020-02-05 19:51:43 +0300 |
commit | 789eb9f24ac72505ef8bd89d6c94a99ba9d7efad (patch) | |
tree | a37ce8aa3015b634a3eccb5d9b7960c22695ec3c /main_test.go | |
parent | 37a1c96b0be5edc140fea87812854f63c8854542 (diff) | |
download | radiorus-rss-789eb9f24ac72505ef8bd89d6c94a99ba9d7efad.tar.gz radiorus-rss-789eb9f24ac72505ef8bd89d6c94a99ba9d7efad.zip |
parse episodes more safely
Diffstat (limited to 'main_test.go')
-rw-r--r-- | main_test.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/main_test.go b/main_test.go index 2d520cb..d00a6ae 100644 --- a/main_test.go +++ b/main_test.go @@ -27,6 +27,7 @@ import ( "os/exec" "path/filepath" "regexp" + "strconv" "strings" "sync" "testing" @@ -91,6 +92,21 @@ func TestFeed(t *testing.T) { assertGolden(t, actual, golden) } +func TestBadEpisode(t *testing.T) { + feed := &feeds.Feed{ + Link: &feeds.Link{Href: "http://www.radiorus.ru/brand/57083/episodes"}, + } + + for i := 0; i <= 1; i++ { + page := helperLoadBytes(t, "episodes.badep."+strconv.Itoa(i)) + page = cleanText(page) + + if err := populateFeed(feed, page); err != errBadEpisode { + t.Error("for sample", i, "want:", errBadEpisode, "got:", err) + } + } +} + func TestFindEpisodes(t *testing.T) { var tests = []string{ "episodes", |