roster_test.go
changeset 36 9fe022261dcc
child 38 2839fece923e
equal deleted inserted replaced
35:569833f08780 36:9fe022261dcc
       
     1 // Copyright 2011 The Go Authors.  All rights reserved.
       
     2 // Use of this source code is governed by a BSD-style
       
     3 // license that can be found in the LICENSE file.
       
     4 
       
     5 package xmpp
       
     6 
       
     7 import (
       
     8 	"testing"
       
     9 	"xml"
       
    10 )
       
    11 
       
    12 // This is mostly just tests of the roster data structures.
       
    13 
       
    14 func TestRosterIqMarshal(t *testing.T) {
       
    15 	iq := &RosterIq{Iq: Iq{From: "from", Lang: "en"}, Query:
       
    16 		RosterQuery{XMLName: xml.Name{Space: NsRoster, Local:
       
    17 				"query"}, Item: []RosterItem{}}}
       
    18 	var s Stanza = iq
       
    19 	if _, ok := s.(ExtendedStanza) ; !ok {
       
    20 		t.Errorf("Not an ExtendedStanza")
       
    21 	}
       
    22 	exp := `<iq from="from" xml:lang="en"><query xmlns="` +
       
    23 		NsRoster + `"></query></iq>`
       
    24 	assertMarshal(t, exp, iq)
       
    25 }