Skip to content

Commit 542edfa

Browse files
committed
#151: To make the test work, the parsed extensions have to take a json roundtrip
1 parent 6018a29 commit 542edfa

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

rss/parser_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ func TestParser_Parse(t *testing.T) {
3030
fp := &rss.Parser{}
3131
actual, _ := fp.Parse(bytes.NewReader(f), gofeed.NewParser().BuildRSSExtParsers())
3232

33+
// the `Parsed` part of extensions is not correctly unmarshalled from JSON
34+
// workaround: move the actual extensions through a round of json marshalling so that we get the same
35+
for _, i := range actual.Items {
36+
if len(i.Extensions) > 0 {
37+
b, _ := json.Marshal(i.Extensions)
38+
json.Unmarshal(b, &i.Extensions)
39+
}
40+
}
41+
3342
// Get json encoded expected feed result
3443
ef := fmt.Sprintf("../testdata/parser/rss/%s.json", name)
3544
e, _ := ioutil.ReadFile(ef)

0 commit comments

Comments
 (0)