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