~samwhited/xmpp

ref: 16fcfed077a257f695ebd100e188e0ceaa5049c7 xmpp/internal/xmpptest/marshal_test.go -rw-r--r-- 646 bytes
16fcfed0Sam Whited internal/stream: remove s2s bool from stream send 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2021 The Mellium Contributors.
// Use of this source code is governed by the BSD 2-clause
// license that can be found in the LICENSE file.

package xmpptest_test

import (
	"encoding/xml"
	"testing"

	"mellium.im/xmpp/internal/xmpptest"
)

var marshalTestCases = []xmpptest.EncodingTestCase{
	0: {
		NoMarshal: true,
		Value:     &struct{ Foo int }{Foo: 0},
		XML:       `<Foo>0</Foo>`,
	},
	1: {
		NoUnmarshal: true,
		Value: &struct {
			XMLName xml.Name `xml:"foo"`
			Foo     int      `xml:",chardata"`
		}{Foo: 0},
		XML: `<foo>0</foo>`,
	},
}

func TestEncode(t *testing.T) {
	xmpptest.RunEncodingTests(t, marshalTestCases)
}