forked from jshiffer/go-xmpp
PubSub protocol support (#142)
* PubSub protocol support Added support for : - XEP-0050 (Command)) - XEP-0060 (PubSub) - XEP-0004 (Forms) Fixed the NewClient function by adding parsing of the domain from the JID if no domain is provided in transport config. Updated xmpp_jukebox example * Delete useless pubsub errors * README.md update Fixed import in echo example * Typo * Fixed raw send on client example * Fixed jukebox example and added a README.md
This commit is contained in:
committed by
Jérôme Sautret
parent
6e2ba9ca57
commit
947fcf0432
@@ -2,12 +2,17 @@ package stanza_test
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"gosrc.io/xmpp/stanza"
|
||||
)
|
||||
|
||||
var reLeadcloseWhtsp = regexp.MustCompile(`^[\s\p{Zs}]+|[\s\p{Zs}]+$`)
|
||||
var reInsideWhtsp = regexp.MustCompile(`[\s\p{Zs}]`)
|
||||
|
||||
// ============================================================================
|
||||
// Marshaller / unmarshaller test
|
||||
|
||||
@@ -63,3 +68,14 @@ func xmlOpts() cmp.Options {
|
||||
}
|
||||
return opts
|
||||
}
|
||||
|
||||
func delSpaces(s string) string {
|
||||
return reInsideWhtsp.ReplaceAllString(reLeadcloseWhtsp.ReplaceAllString(s, ""), "")
|
||||
}
|
||||
|
||||
func compareMarshal(expected, data string) error {
|
||||
if delSpaces(expected) != delSpaces(data) {
|
||||
return errors.New("failed to verify unmarshal->marshal. Expected :" + expected + "\ngot: " + data)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user