roster_test.go
author Chris Jones <chris@cjones.org>
Fri, 30 Dec 2011 21:49:00 -0700
changeset 36 9fe022261dcc
child 38 2839fece923e
permissions -rw-r--r--
Added a capability to use extensions. There are still some bugs with marshaling involving receiver functions on embedded structs.

// Copyright 2011 The Go Authors.  All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package xmpp

import (
	"testing"
	"xml"
)

// This is mostly just tests of the roster data structures.

func TestRosterIqMarshal(t *testing.T) {
	iq := &RosterIq{Iq: Iq{From: "from", Lang: "en"}, Query:
		RosterQuery{XMLName: xml.Name{Space: NsRoster, Local:
				"query"}, Item: []RosterItem{}}}
	var s Stanza = iq
	if _, ok := s.(ExtendedStanza) ; !ok {
		t.Errorf("Not an ExtendedStanza")
	}
	exp := `<iq from="from" xml:lang="en"><query xmlns="` +
		NsRoster + `"></query></iq>`
	assertMarshal(t, exp, iq)
}