~samwhited/xmpp

ref: bb3bf8e486439ef6d8109b0d91cb8d2bcb3fec4b xmpp/internal/marshal/encode.go -rw-r--r-- 1.9 KiB
internal/marshal: use data driven testing

Add tests for all branches using a table driven test to exercise
various error conditions.

Signed-off-by: Sam Whited <sam@samwhited.com>
internal/marshal: return existing TokenReaders

Short circuit from marshal.TokenReader if the input is already a
TokenReader to avoid the overhead of re-encoding everything in this
niche special case.

See #38

Signed-off-by: Sam Whited <sam@samwhited.com>
all: update BUG comments

Remove inaccurate BUG comments and update existing ones to contain a
link to their relavant issue so that they get removed if the issue is
closed.

Signed-off-by: Sam Whited <sam@samwhited.com>
internal/marshal: add TokenReader API

While thinking about whether or not it would be difficult to add
EncodeIQ and EncodeIQElement methods to Session I realized that I
wouldn't be able to implement them in terms of SendIQ and SendIQ element
because these use a token reader based API as opposed to the token
writer based API used by the functions in Marshal. However, internally
the marshal functions create a token reader and then copy from it into
the writer, so by exposing this functionality we can make it possible to
create reader or writer based functionality with the marshal package.

Signed-off-by: Sam Whited <sam@samwhited.com>
all: add missing canonical import comments

Signed-off-by: Sam Whited <sam@samwhited.com>
internal/marshal: add package description
all: move encoding funcs into internal/marshal
internal: add XML struct encoding workaround

This is a very inefficient work around for the encoding/xml package not
supporting any way to encode to a token stream.
Hopefully it will eventually be replaced if the encoding/xml package
ever gets updated.
Next