From 54d4e6c7769ab26474e03ccbbb62adec0471bf18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Sat, 22 Aug 2020 17:42:17 +0200 Subject: [PATCH] #151: To make the test work, the parsed extensions have to take a json roundtrip --- rss/parser_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rss/parser_test.go b/rss/parser_test.go index 35f4872a..22ef361c 100644 --- a/rss/parser_test.go +++ b/rss/parser_test.go @@ -30,6 +30,15 @@ func TestParser_Parse(t *testing.T) { fp := &rss.Parser{} actual, _ := fp.Parse(bytes.NewReader(f), gofeed.NewParser().BuildRSSExtParsers()) + // the `Parsed` part of extensions is not correctly unmarshalled from JSON + // workaround: move the actual extensions through a round of json marshalling so that we get the same + for _, i := range actual.Items { + if len(i.Extensions) > 0 { + b, _ := json.Marshal(i.Extensions) + json.Unmarshal(b, &i.Extensions) + } + } + // Get json encoded expected feed result ef := fmt.Sprintf("../testdata/parser/rss/%s.json", name) e, _ := ioutil.ReadFile(ef)