~samwhited/xmpp

9530b69413374e9f04eab15cbd5fb5bacfb7231f — Sam Whited 1 year, 7 months ago 380dda6
xmpp, xmpp/sasl2: improve test error handling

Also fixes several ineffectual assignments in test files.
3 files changed, 23 insertions(+), 8 deletions(-)

M sasl2/sasl_test.go
M sasl_test.go
M starttls_test.go
M sasl2/sasl_test.go => sasl2/sasl_test.go +10 -4
@@ 58,16 58,22 @@ func TestSASLList(t *testing.T) {
		t.Errorf("Unexpected name for mechanisms start element: %+v", se.Name)
	}
	// Skip two mechanisms
	tok, err = d.Token()
	_, err = d.Token()
	if err != nil {
		t.Fatal(err)
	}
	d.Skip()
	tok, err = d.Token()
	err = d.Skip()
	if err != nil {
		t.Fatal(err)
	}
	_, err = d.Token()
	if err != nil {
		t.Fatal(err)
	}
	err = d.Skip()
	if err != nil {
		t.Fatal(err)
	}
	d.Skip()

	// Check the end token.
	tok, err = d.Token()

M sasl_test.go => sasl_test.go +10 -4
@@ 59,16 59,22 @@ func TestSASLList(t *testing.T) {
		t.Errorf("Unexpected name for mechanisms start element: %+v", se.Name)
	}
	// Skip two mechanisms
	tok, err = d.Token()
	_, err = d.Token()
	if err != nil {
		t.Fatal(err)
	}
	d.Skip()
	tok, err = d.Token()
	err = d.Skip()
	if err != nil {
		t.Fatal(err)
	}
	_, err = d.Token()
	if err != nil {
		t.Fatal(err)
	}
	err = d.Skip()
	if err != nil {
		t.Fatal(err)
	}
	d.Skip()

	// Check the end token.
	tok, err = d.Token()

M starttls_test.go => starttls_test.go +3 -0
@@ 68,6 68,9 @@ func TestStartTLSList(t *testing.T) {
					t.Errorf("Expected starttls required to have no attributes but got %d", len(se.Attr))
				}
				tok, err = d.Token()
				if err != nil {
					t.Fatal(err)
				}
				ee := tok.(xml.EndElement)
				switch {
				case se.Name != xml.Name{Space: ns.StartTLS, Local: "required"}: