Skip to content

test: ensure BytesMut::advance reduces capacity#728

Merged
seanmonstar merged 1 commit intotokio-rs:masterfrom
camshaft:master
Aug 2, 2024
Merged

test: ensure BytesMut::advance reduces capacity#728
seanmonstar merged 1 commit intotokio-rs:masterfrom
camshaft:master

Conversation

@camshaft
Copy link
Copy Markdown
Contributor

@camshaft camshaft commented Aug 2, 2024

This PR adds a test to ensure the behavior of BytesMut::advance is preserved in order to avoid #725.

I also confirmed that this test fails with the change from #698.

---- advance_bytes_mut_remaining_capacity stdout ----
testing capacity=0, len=0, advance=0
testing capacity=1, len=0, advance=0
testing capacity=1, len=1, advance=0
testing capacity=1, len=1, advance=1
thread 'advance_bytes_mut_remaining_capacity' panicked at tests/test_bytes.rs:701:17:
assertion `left == right` failed: Buf::advance should reduce the remaining capacity
  left: 1
 right: 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    advance_bytes_mut_remaining_capacity

@seanmonstar seanmonstar enabled auto-merge (squash) August 2, 2024 16:55
@camshaft
Copy link
Copy Markdown
Contributor Author

camshaft commented Aug 2, 2024

Looks like my brute force test is quite slow under miri. I think it's probably a good idea to reduce the search space a bit under that mode.

auto-merge was automatically disabled August 2, 2024 17:07

Head branch was pushed to by a user without write access

@camshaft camshaft requested a review from seanmonstar August 2, 2024 18:11
@seanmonstar seanmonstar enabled auto-merge (squash) August 2, 2024 18:57
@seanmonstar seanmonstar merged commit ed7d5ff into tokio-rs:master Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants