~samwhited/xmpp

xmpp/commands/actions_test.go -rw-r--r-- 1.0 KiB
d267daa0Sam Whited .builds: ignore buggy gosec warning 48 minutes 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
33
34
35
36
37
38
// 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 commands_test

import (
	"testing"

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

func TestActions(t *testing.T) {
	xmpptest.RunEncodingTests(t, []xmpptest.EncodingTestCase{
		{
			Value: func() *commands.Actions {
				action := commands.Prev | commands.Next | commands.Complete
				return &action
			}(),
			XML: `<actions><prev></prev><next></next><complete></complete></actions>`,
		},
		{
			Value: func() *commands.Actions {
				action := commands.Next | commands.Complete | (commands.Next << 3)
				return &action
			}(),
			XML: `<actions execute="next"><next></next><complete></complete></actions>`,
		},
		{
			Value: func() *commands.Actions {
				action := commands.Next | commands.Complete | (commands.Prev << 3)
				return &action
			}(),
			XML: `<actions execute="prev"><next></next><complete></complete></actions>`,
		},
	})
}