~samwhited/xmpp

ref: 16fcfed077a257f695ebd100e188e0ceaa5049c7 xmpp/internal/xmpptest/tokens_test.go -rw-r--r-- 698 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
33
// Copyright 2020 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 (
	"io"
	"testing"

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

func TestTokens(t *testing.T) {
	toks := xmpptest.Tokens{0, 1, 2}
	for i := 0; i < 3; i++ {
		tok, err := toks.Token()
		if err != nil {
			t.Errorf("unexpected error on token %d: %v", i, err)
		}
		if tok.(int) != i {
			t.Errorf("unexpcted token: want=%d, got=%v", i, tok)
		}
	}

	tok, err := toks.Token()
	if err != io.EOF {
		t.Errorf("unexpected error: want=%v, got=%v", io.EOF, err)
	}
	if tok != nil {
		t.Errorf("unexpcted token: %v", tok)
	}
}