forked from baliw/moverss
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gopod_test.go
51 lines (44 loc) · 1.14 KB
/
gopod_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// This package implements a RSS/Podcast 2.0 feed generator
//
// Test code for gopod.
//
// Use `go test` on the commandline to test this package
//
//
package gopod
import (
"fmt"
"testing"
"time"
)
func Test1(*testing.T) {
fmt.Printf("Testing gopod...\n")
c := ChannelFactory("Daniel's Channel", "http://RubyDeveloper.com/", "My Blog", "http://example.com/image.png")
c.SetPubDate(time.Now().UTC())
c.SetiTunesExplicit("No")
c.AddItem(&Item{
Title: "Stack Overflow",
Link: "http://stackoverflow.com",
Description: "Stack Overflow",
PubDate: time.Now().UTC().Format(time.RFC1123),
})
// Example: Using an item's methods
t := "My title"
l := "http://linkedin.com"
i := &Item{
Title: t,
TunesSubtitle: t,
Link: l,
Description: "My LinkedIn",
TunesDuration: "600",
TunesSummary: "I asked myself that question more than a decade ago and it changed my...",
Guid: l,
Creator: "Daniel's Channel",
}
i.SetEnclosure("http://example.com/sound.mp3", "600", "audio/mpeg")
i.SetPubDate(time.Now().Unix())
c.AddItem(i)
fmt.Printf("%s\n\n", c.Publish())
fmt.Printf("%s\n\n", c.PublishIndent())
}