Skip to content

Commit 4d3bbd5

Browse files
committed
[proptest-types] generate limits from 1 rather than 0
Generate values from 1 because 0 for writers can mean that writes are no longer accepted.
1 parent 40e543f commit 4d3bbd5

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [0.5.4] - 2022-09-27
4+
5+
### Fixed
6+
7+
- For proptest, generate `PartialOp::Limited` byte counts starting at 1 rather than 0. This is because
8+
0 can mean no more data is available in the stream.
9+
310
## [0.5.3] - 2022-09-27
411

512
### Updated
@@ -31,7 +38,8 @@
3138

3239
For information about earlier versions, please review the [commit history](https://github.com/sunshowers-code/partial-io/commits/main).
3340

34-
[0.5.2]: https://github.com/sunshowers-code/partial-io/releases/tag/0.5.3
41+
[0.5.4]: https://github.com/sunshowers-code/partial-io/releases/tag/0.5.4
42+
[0.5.3]: https://github.com/sunshowers-code/partial-io/releases/tag/0.5.3
3543
[0.5.2]: https://github.com/sunshowers-code/partial-io/releases/tag/0.5.2
3644
[0.5.1]: https://github.com/sunshowers-code/partial-io/releases/tag/0.5.1
3745

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "partial-io"
3-
version = "0.5.3"
3+
version = "0.5.4"
44
edition = "2021"
55
authors = ["Rain <[email protected]>"]
66
description = "Helpers to test partial, interrupted and would-block I/O operations, with support for property-based testing through proptest and quickcheck."

src/proptest_types.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ pub fn partial_op_strategy(
4747
error_strategy: impl Strategy<Value = Option<io::ErrorKind>>,
4848
limit_bytes: usize,
4949
) -> impl Strategy<Value = PartialOp> {
50-
(error_strategy, 0..=limit_bytes).prop_map(|(error_kind, limit)| match error_kind {
50+
// Don't generate 0 because for writers it can mean that writes are no longer accepted.
51+
(error_strategy, 1..=limit_bytes).prop_map(|(error_kind, limit)| match error_kind {
5152
Some(kind) => PartialOp::Err(kind),
5253
None => PartialOp::Limited(limit),
5354
})

0 commit comments

Comments
 (0)