structs_test.go
changeset 22 d6b7b4cbf50d
parent 21 8f6ae5cfc9b9
child 24 fff79efe06f6
equal deleted inserted replaced
21:8f6ae5cfc9b9 22:d6b7b4cbf50d
    48 	observed := string(buf.Bytes())
    48 	observed := string(buf.Bytes())
    49 	assertEquals(t, expected, observed)
    49 	assertEquals(t, expected, observed)
    50 }
    50 }
    51 
    51 
    52 func TestStreamMarshal(t *testing.T) {
    52 func TestStreamMarshal(t *testing.T) {
    53 	s := &Stream{To: "bob"}
    53 	s := &stream{To: "bob"}
    54 	exp := `<stream:stream xmlns="jabber:client"` +
    54 	exp := `<stream:stream xmlns="jabber:client"` +
    55 		` xmlns:stream="` + nsStream + `" to="bob">`
    55 		` xmlns:stream="` + nsStream + `" to="bob">`
    56 	assertMarshal(t, exp, s)
    56 	assertMarshal(t, exp, s)
    57 
    57 
    58 	s = &Stream{To: "bob", From: "alice", Id: "#3", Version: "5.3"}
    58 	s = &stream{To: "bob", From: "alice", Id: "#3", Version: "5.3"}
    59 	exp = `<stream:stream xmlns="jabber:client"` +
    59 	exp = `<stream:stream xmlns="jabber:client"` +
    60 		` xmlns:stream="` + nsStream + `" to="bob" from="alice"` +
    60 		` xmlns:stream="` + nsStream + `" to="bob" from="alice"` +
    61 		` id="#3" version="5.3">`
    61 		` id="#3" version="5.3">`
    62 	assertMarshal(t, exp, s)
    62 	assertMarshal(t, exp, s)
    63 
    63 
    64 	s = &Stream{Lang: "en_US"}
    64 	s = &stream{Lang: "en_US"}
    65 	exp = `<stream:stream xmlns="jabber:client"` +
    65 	exp = `<stream:stream xmlns="jabber:client"` +
    66 		` xmlns:stream="` + nsStream + `" xml:lang="en_US">`
    66 		` xmlns:stream="` + nsStream + `" xml:lang="en_US">`
    67 	assertMarshal(t, exp, s)
    67 	assertMarshal(t, exp, s)
    68 }
    68 }
    69 
    69