File tree Expand file tree Collapse file tree 3 files changed +48
-1
lines changed
Expand file tree Collapse file tree 3 files changed +48
-1
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "items" : [
3+ {
4+ "author" : {
5+ "name" : " Item Author"
6+ },
7+ "extensions" : {
8+ "atom" : {
9+ "author" : [
10+ {
11+ "name" : " author" ,
12+ "value" : " " ,
13+ "parsed" : {
14+ "authors" : [
15+ {
16+ "name" : " Item Author"
17+ }
18+ ]
19+ }
20+ }
21+ ]
22+ }
23+ }
24+ }
25+ ],
26+ "feedType" : " rss" ,
27+ "feedVersion" : " 2.0"
28+ }
Original file line number Diff line number Diff line change 1+ <!--
2+ Description: rss item with atom author
3+ -->
4+ <rss version =" 2.0" xmlns : a10 =" http://www.w3.org/2005/Atom" >
5+ <channel >
6+ <item >
7+ <a10 : author ><a10 : name >Item Author</a10 : name ></a10 : author >
8+ </item >
9+ </channel >
10+ </rss >
Original file line number Diff line number Diff line change @@ -32,9 +32,18 @@ func TestDefaultRSSTranslator_Translate(t *testing.T) {
3232 // Parse actual feed
3333 translator := & gofeed.DefaultRSSTranslator {}
3434 fp := & rss.Parser {}
35- rssFeed , _ := fp .Parse (f )
35+ rssFeed , _ := fp .Parse (f , gofeed . NewParser (). BuildRSSExtParsers () )
3636 actual , _ := translator .Translate (rssFeed )
3737
38+ // the `Parsed` part of extensions is not correctly unmarshalled from JSON
39+ // workaround: move the actual extensions through a round of json marshalling so that we get the same
40+ for _ , i := range actual .Items {
41+ if len (i .Extensions ) > 0 {
42+ b , _ := json .Marshal (i .Extensions )
43+ json .Unmarshal (b , & i .Extensions )
44+ }
45+ }
46+
3847 // Get json encoded expected feed result
3948 ef := fmt .Sprintf ("testdata/translator/rss/%s.json" , name )
4049 e , _ := ioutil .ReadFile (ef )
You can’t perform that action at this time.
0 commit comments