Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Encode methods accept []byte #36

Draft
wants to merge 57 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
cd91cc0
wip
noisersup Sep 4, 2024
0768049
wip
noisersup Sep 4, 2024
9e1e3ad
wip
noisersup Sep 4, 2024
ffbce94
keep
noisersup Sep 4, 2024
05fd355
Revert "keep"
noisersup Sep 4, 2024
c24cdf9
wip
noisersup Sep 4, 2024
9aa72ad
cap
noisersup Sep 6, 2024
116bd79
oof
noisersup Sep 6, 2024
0ba5399
wip
noisersup Sep 6, 2024
4388911
wip
noisersup Sep 6, 2024
6d3425d
wip
noisersup Sep 6, 2024
72494e2
wip
noisersup Sep 7, 2024
d1ebbaf
wip
noisersup Sep 7, 2024
c181cd3
wip
noisersup Sep 7, 2024
dd0a228
wip
noisersup Sep 9, 2024
99820cb
wip
noisersup Sep 11, 2024
7d65b15
revert
noisersup Sep 12, 2024
b26d225
Merge branch 'doc-encode-byte-21-2' into doc-encode-byte-21
noisersup Sep 12, 2024
1346fe2
wip
noisersup Sep 12, 2024
a08e5a1
wip
noisersup Sep 12, 2024
dcf1b1b
wip
noisersup Sep 12, 2024
5f28ffc
wip
noisersup Sep 12, 2024
9546de2
wip
noisersup Sep 12, 2024
b932258
wip
noisersup Sep 12, 2024
702798a
wip
noisersup Sep 13, 2024
f5d82af
write directly to subslice
noisersup Sep 13, 2024
7076440
wip
noisersup Sep 13, 2024
1155ef2
wip
noisersup Sep 13, 2024
076b324
remove writeByte
noisersup Sep 13, 2024
7d115af
refactor write
noisersup Sep 13, 2024
20e8069
wip
noisersup Sep 13, 2024
5e5e73e
wip
noisersup Sep 13, 2024
5d45057
convert array
noisersup Sep 13, 2024
73836e3
test
noisersup Sep 13, 2024
5ec1fc4
bench
noisersup Sep 13, 2024
7f13077
wip
noisersup Sep 13, 2024
8dd7397
wip
noisersup Sep 13, 2024
1a4d945
wip
noisersup Sep 13, 2024
f6151af
wip
noisersup Sep 13, 2024
70c05bb
wip
noisersup Sep 13, 2024
c84c84a
less error
noisersup Sep 13, 2024
c87f7ab
simplify test
noisersup Sep 13, 2024
b7510cd
wip
noisersup Sep 13, 2024
5aa5871
wip
noisersup Sep 13, 2024
b231449
Merge remote-tracking branch 'upstream/main' into doc-encode-byte-21
noisersup Sep 13, 2024
b67c25b
test
noisersup Sep 13, 2024
28ccc75
fix bench
noisersup Sep 13, 2024
fa03706
Merge remote-tracking branch 'upstream/main' into doc-encode-byte-21
noisersup Sep 16, 2024
8620b82
Merge branch 'main' into doc-encode-byte-21
AlekSi Sep 19, 2024
e9b08a7
Add notes
AlekSi Sep 19, 2024
58e30d9
Rename method
AlekSi Dec 16, 2024
a519e92
Add transition methods
AlekSi Dec 16, 2024
7fc88db
More transitions
AlekSi Dec 16, 2024
aff88f3
Revert some changes
AlekSi Dec 16, 2024
bcbad32
Revert
AlekSi Dec 16, 2024
49b0fd0
Merge branch 'main' into pr/noisersup/36-1
AlekSi Dec 16, 2024
ed4fe55
Rename
AlekSi Dec 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert
  • Loading branch information
AlekSi committed Dec 16, 2024
commit bcbad321fdbf1f7f8370874bde5571fc096c96d5
9 changes: 4 additions & 5 deletions wire_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"errors"
"os"
"path/filepath"
"strings"
"testing"
"time"

Expand All @@ -40,9 +41,7 @@ func TestMain(m *testing.M) {
func makeRawDocument(pairs ...any) wirebson.RawDocument {
d := wirebson.MustDocument(pairs...)

raw := make([]byte, wirebson.Size(d))

err := d.EncodeTo(raw)
raw, err := d.Encode()
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -72,7 +71,7 @@ type testCase struct {
msgHeader *MsgHeader
msgBody MsgBody
command string // only for OpMsg
b string
si string
err string // unwrapped
}

Expand Down Expand Up @@ -129,7 +128,7 @@ func testMessages(t *testing.T, testCases []testCase) {
require.NotNil(t, msgHeader)
require.NotNil(t, msgBody)
assert.NotEmpty(t, msgHeader.String())
assert.Equal(t, testutil.Unindent(tc.b), msgBody.StringIndent())
assert.Equal(t, strings.ReplaceAll(testutil.Unindent(tc.si), `"`, "`"), msgBody.StringIndent())
assert.NotEmpty(t, msgBody.String())

require.NoError(t, msgBody.check())
Expand Down