equal
deleted
inserted
replaced
14 ) |
14 ) |
15 |
15 |
16 func TestReadError(t *testing.T) { |
16 func TestReadError(t *testing.T) { |
17 r := strings.NewReader(`<stream:error><bad-foo/></stream:error>`) |
17 r := strings.NewReader(`<stream:error><bad-foo/></stream:error>`) |
18 ch := make(chan interface{}) |
18 ch := make(chan interface{}) |
19 go readXml(r, ch, make(map[string] func(*xml.Name) ExtendedStanza)) |
19 go readXml(r, ch, make(map[string] func(*xml.Name) interface{})) |
20 x := <- ch |
20 x := <- ch |
21 se, ok := x.(*streamError) |
21 se, ok := x.(*streamError) |
22 if !ok { |
22 if !ok { |
23 t.Fatalf("not StreamError: %v", reflect.TypeOf(x)) |
23 t.Fatalf("not StreamError: %v", reflect.TypeOf(x)) |
24 } |
24 } |
30 |
30 |
31 r = strings.NewReader(`<stream:error><bad-foo/>` + |
31 r = strings.NewReader(`<stream:error><bad-foo/>` + |
32 `<text xml:lang="en" xmlns="` + NsStreams + |
32 `<text xml:lang="en" xmlns="` + NsStreams + |
33 `">Error text</text></stream:error>`) |
33 `">Error text</text></stream:error>`) |
34 ch = make(chan interface{}) |
34 ch = make(chan interface{}) |
35 go readXml(r, ch, make(map[string] func(*xml.Name) ExtendedStanza)) |
35 go readXml(r, ch, make(map[string] func(*xml.Name) interface{})) |
36 x = <- ch |
36 x = <- ch |
37 se, ok = x.(*streamError) |
37 se, ok = x.(*streamError) |
38 if !ok { |
38 if !ok { |
39 t.Fatalf("not StreamError: %v", reflect.TypeOf(x)) |
39 t.Fatalf("not StreamError: %v", reflect.TypeOf(x)) |
40 } |
40 } |
48 r := strings.NewReader(`<stream:stream to="foo.com" ` + |
48 r := strings.NewReader(`<stream:stream to="foo.com" ` + |
49 `from="bar.org" id="42"` + |
49 `from="bar.org" id="42"` + |
50 `xmlns="jabber:client" xmlns:stream="` + NsStream + |
50 `xmlns="jabber:client" xmlns:stream="` + NsStream + |
51 `" version="1.0">`) |
51 `" version="1.0">`) |
52 ch := make(chan interface{}) |
52 ch := make(chan interface{}) |
53 go readXml(r, ch, make(map[string] func(*xml.Name) ExtendedStanza)) |
53 go readXml(r, ch, make(map[string] func(*xml.Name) interface{})) |
54 x := <- ch |
54 x := <- ch |
55 ss, ok := x.(*stream) |
55 ss, ok := x.(*stream) |
56 if !ok { |
56 if !ok { |
57 t.Fatalf("not stream: %v", reflect.TypeOf(x)) |
57 t.Fatalf("not stream: %v", reflect.TypeOf(x)) |
58 } |
58 } |