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

Remove length encoding #102

Merged
merged 2 commits into from Feb 3, 2017
Merged

Remove length encoding #102

merged 2 commits into from Feb 3, 2017

Conversation

@ZoeyR
Copy link
Collaborator

ZoeyR commented Feb 1, 2017

Closes #86

@@ -398,6 +398,6 @@ fn bytes() {
let data = b"abc\0123";
let s = serialize(&data, Infinite).unwrap();
let s2 = serialize(&Bytes::new(data), Infinite).unwrap();
assert_eq!(s, s2);
assert_ne!(s, s2);

This comment has been minimized.

@TyOverby

TyOverby Feb 3, 2017

Collaborator

assert_ne isn't really buying us much test coverage here. Could you replace this with a comparison against the serialized data?

e.g. assert_eq!(s, vec![ byte values here ])

This comment has been minimized.

@ZoeyR

ZoeyR Feb 3, 2017

Author Collaborator

So I'm looking at the tests we already have. We do fixed sized array tests so just doing assert_eq!(s, vec![ byte values here ]) wouldn't really add anything to the test coverage. What I could do is assert_eq!(s[..], s2[8..]); to verify that after the length encoding they are identical.

This comment has been minimized.

@TyOverby

TyOverby Feb 3, 2017

Collaborator

assert_eq!(s[..], s2[8..]); to verify that after the length encoding they are identical.

That sounds good; I like it!

@@ -398,6 +398,6 @@ fn bytes() {
let data = b"abc\0123";
let s = serialize(&data, Infinite).unwrap();
let s2 = serialize(&Bytes::new(data), Infinite).unwrap();
assert_eq!(s, s2);
assert_ne!(s, s2);
}

This comment has been minimized.

@TyOverby

TyOverby Feb 3, 2017

Collaborator

Please add another test that does serialization and deserialization.

This comment has been minimized.

@ZoeyR

ZoeyR Feb 3, 2017

Author Collaborator

Since we do tests for fixed sized arrays, is adding a test for both serialization and deserialization really necessary?

This comment has been minimized.

@TyOverby

TyOverby Feb 3, 2017

Collaborator

Looking at this some more, I think that my request is out-of-scope for this PR. However, the structures serde::bytes::Bytes and serde::bytes::ByteBuf have special handling that we certainly want to be testing. I'll file another issue for this.

@TyOverby TyOverby merged commit a16afaf into servo:master Feb 3, 2017
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.