forked from fragforce/fragcenter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfragcenter_test.go
39 lines (34 loc) · 854 Bytes
/
fragcenter_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
package main
import (
"encoding/xml"
"io/ioutil"
"os"
"path/filepath"
"testing"
)
// TestParsing ensures that all of the example payloads provided parse into the struct we defined
func TestParsing(t *testing.T) {
files, err := filepath.Glob("resources/test_stats_payloads/*xml")
if err != nil {
t.Errorf("No XML files found in resources/test_stats_payloads.")
t.FailNow()
}
for _, fileName := range files {
f, err := os.Open(fileName)
if err != nil {
t.Errorf("Couldn't open the file '%s'.", fileName)
continue
}
xmlBytes, err := ioutil.ReadAll(f)
if err != nil {
t.Errorf("Couldn't read the bytes in the file '%s'.", fileName)
continue
}
var streams LiveStreams
err = xml.Unmarshal(xmlBytes, &streams)
if err != nil {
t.Errorf("Couldn't unmarshal the XML in file '%s'.", fileName)
continue
}
}
}