Debian Codegraph @

debian/missing-sources/proptest/CHANGELOG.md

raw symbols SCIP
1 ## Unreleased
2
3 ## 1.9.0
4
5 ### Breaking Changes
6
7 - The minimum supported Rust version has been increased to 1.82.0. ([\#605](https://github.com/proptest-rs/proptest/pull/605))
8
9 ### New Features
10
11 - Added `ProptestResultExt` trait with `prop_assume_ok` helper method for converting `Result` types to test outcomes. ([\#589](https://github.com/proptest-rs/proptest/pull/589))
12
13 ### Other Notes
14
15 - Replaced `lazy_static` dependency with `std::sync::LazyLock`. ([\#546](https://github.com/proptest-rs/proptest/pull/546))
16 - Fixed doctest and cleaned up warnings. ([\#606](https://github.com/proptest-rs/proptest/pull/606))
17
18 ## 1.8.0
19
20 ### New Features
21
22 - Implement `Arbitrary` for `Saturating<T>`. ([\#585](https://github.com/proptest-rs/proptest/pull/585))
23 - Allow `prop_assert!` with trailing comma. ([\#581](https://github.com/proptest-rs/proptest/pull/581))
24
25 ### Bug Fixes
26
27 - Fix arithmetic overflow on 32-bit processors. ([\#596](https://github.com/proptest-rs/proptest/pull/596))
28 - Sanitize user-facing macros to use fully qualified paths, preventing conflicts with user code. ([\#584](https://github.com/proptest-rs/proptest/pull/584))
29
30 ## 1.7.0
31
32 ### Other Notes
33
34 - Updated `rand` dependency from 0.8 to 0.9.
35 - Bump all dependencies to latest compatible with MSRV 1.66.
36
37 ## 1.6.0
38
39 ### New Features
40
41 - Added `handle-panics` feature which enables catching panics raised in tests
42 and turning them into failures. ([\#525](https://github.com/proptest-rs/proptest/pull/525))
43 - Exit early if shrink disabled. ([\#520](https://github.com/proptest-rs/proptest/pull/520))
44 - Add `Config::with_failure_persistence`. A convenience constructor making use
45 of a generic parameter over `FailurePersistence` impls and hiding the
46 `Some(Box::new(...))`. ([\#508](https://github.com/proptest-rs/proptest/pull/508))
47 - Add From's for SizeRange and Probability. ([\#498]([https://github.com/proptest-rs/proptest/pull/498))
48 - When running persisted regressions, the most recently added regression is now
49 run first. ([\#496](https://github.com/proptest-rs/proptest/pull/496]))
50
51 ### Bug Fixes
52
53 - Fix WebAssembly support. Hides a few paths, that fail at runtime on
54 wasm32-unknown-unknown, under conditional compilation. \([#519](https://github.com/proptest-rs/proptest/pull/519))
55 - Fix incorrectly reading environment configuration. Previously controlling
56 proptest configuration via env vars was not properly applied. This caused
57 vars like `PROPTEST_MAX_DEFAULT_SIZE_RANGE` to be not be properly applied,
58 leading to unexpected behavior. ([\#457](https://github.com/proptest-rs/proptest/pull/457))
59 - Allow trailing comma in prop_assert_eq/ne like std. ([\#510](https://github.com/proptest-rs/proptest/pull/510))
60
61 ### Other Notes
62
63 - Add `no_std` to `alloc` contexts. `no_std` must be used explicitly with
64 `alloc`. Updated CI and documentation to reflect this. ([\#528](https://github.com/proptest-rs/proptest/pull/528))
65 - Make `libm` optional in a `std` environment. ([\#524](https://github.com/proptest-rs/proptest/pull/524))
66 - Update `bit-set` and `bit-vec` to `0.8.0`. ([\#501](https://github.com/proptest-rs/proptest/pull/501))
67 - Removed unused `frunk` feature. ([\#498](https://github.com/proptest-rs/proptest/pull/498))
68
69 ## 1.5.0
70
71 ### New Features
72
73 - Setting `PROPTEST_MAX_DEFAULT_SIZE_RANGE` now customizes the default `SizeRange`
74 used by the default strategies for collections (like `Vec`). The default remains 100.
75 - Empty ranges panic during tree creation instead of during sampling.
76
77 ### Documentation
78
79 - Reference the derive macro in Arbitrary's documentation
80 - Fix broken links in the book
81
82 ### Bug Fixes
83
84 - Fixed issue where config contextualization would clobber existing failure persistence config
85
86 ## 1.4.0
87
88 ### Breaking Changes
89
90 - The minimum supported Rust version has been increased to 1.65.0.
91
92 ### Other Notes
93
94 - `regex-syntax` updated from 0.7 to 0.8
95 - Fixed new clippies
96 - Fixed nightly build where Generator was renamed to Coroutine
97
98 ## 1.3.1
99
100 ### Other Notes
101
102 - `bit-set` updated from 0.5.0 to 0.5.2 to ensure minimum compatible version with bit-vec 0.6
103
104 ## 1.3.0
105
106 ### Breaking Changes
107
108 - The minimum supported Rust version has been increased to 1.64.0.
109
110 ### New Features
111
112 - Adds Arbitrary impl for PathBuf
113 - Permit use of (?-u) in byte-regex strategies, allowing non-utf-8 bytes to be generated
114
115 ### Book
116
117 - Various small fixes -- typos, formatting
118 - Removal of custom theme
119 - Add book page for Tips and Best Practices
120
121 ### Other Notes
122
123 - `regex-syntax` version 0.7 is now used.
124 - Print a seed to stderr for a failed test even when a regressions file is already present.
125 - Fixed a performance issue with `VarBitSet::saturated` that can slow down `VecStrategy`
126 - Remove use of rust feature `core_intrinsics`
127 - Remove no longer needed "break-dead-code" feature
128 - Disable `clippy::arc_with_non_send_sync`
129 - Remove dependency on `byteorder`
130
131 ## 1.2.0
132
133 ### Breaking Changes
134
135 - `PROPTEST_` environment variables now take precedence over tests' non-default
136 configuration.
137
138 ### Bug Fixes
139
140 - Don't implement Arbitrary for NonZeroU128 and NonZeroI128 on wasm targets where
141 u128 and i128 Arbitrary impls don't exist
142
143 ### New Features
144
145 ### Other Notes
146
147 - Minimal failing input is now printed using debug pretty-printing
148 - Made public `VarBitSet`, `SizeRange` read-only methods and num sampling
149 functions in preparation for release of a `proptest-state-machine` crate.
150 - Removed dependency on `quick_error`
151 - Start publishing MSRV
152
153 ## 1.1.0
154
155 ### Bug Fixes
156
157 - Sampling from large ranges of floats such as `(0f32)..` no longer panics
158 with newer versions of the `rand` crate
159 - [dependencies.x86] was bumped to latest current version. x86 crate does
160 was on a very old version 0.33.0 which used a removed macro from rust.
161 - The calculation for the arbitrary impl of Layout was using a max_size that
162 was too large and overflowing Layout. This has been fixed.
163 - Test for arbitrary AllocError was referring to AllocErr which
164 does not exist, this was fixed.
165 - NoneError has been removed from rust so it was subsequently
166 removed from proptest. It was blocking compilation. evidence:
167 https://github.com/rust-lang/rust/issues/85614
168 - `try_reserve` is stable so removed from unstable features
169 - `try_trait` has been changed to `try_trait_v2` so that was adjusted
170 in `Cargo.toml`.
171 - `prop_assert_ne!` now uses fully qualified `prop_assert_eq!`
172 - Persisted tests are not counted against the number of cases to run
173
174 ### New Features
175
176 - Add `Arbitrary` impls for arrays of all sizes using const generics
177 - Add `Arbitrary` impls for `core::num::NonZero*`
178 - Adds ability to disable failure persistence via env var `PROPTEST_DISABLE_FAILURE_PERSISTENCE`
179
180 ### Other Notes
181
182 - `proptest` no longer depends on the `quick-error` crate.
183
184 ## 1.0.0
185
186 ### Breaking Changes
187
188 - The minimum supported Rust version has been increased to 1.50.0.
189
190 - The version of the `rand` crate has been increased to 0.8.
191
192 - Due to changes in the `getrandom` crate, if you wish to use proptest on the
193 `wasm32-unknown-unknown` target, you must manually add a dependency on that
194 crate and enable a feature that will allow it to work. Refer to the
195 `getrandom` crate documentation for more information.
196
197 ### Bug Fixes
198
199 - `prop_shuffle()` can now produce all permutations.
200
201 ### New Features
202
203 - Tuple strategies up to 12 elements are now supported, for parity with the
204 blanket implementations that `std` provides.
205
206 ## 0.10.1
207
208 ### New Features
209
210 - Added `RngAlgorithm::Recorder` and supporting APIs which allow capturing
211 random data generated as part of generating a value or running a test.
212
213 ## 0.10.0
214
215 ### Breaking Changes
216
217 - The version of the `rand` crate has been increased to 0.7.
218
219 - The `proptest!` macro no longer accepts function bodies which implicitly
220 return a value (which would then be discarded).
221
222 - The `TupleUnion` implementation in `proptest` 0.9 has been removed and
223 replaced with `LazyTupleUnion`. `prop_oneof!` is unaffected and continues
224 to be the recommended way to build a union of strategies.
225
226 ### New Features
227
228 - Enabling the `hardware-rng` optional dependency (disabled by default) allows
229 obtaining non-deterministic random seeds even in `no_std` environments
230 provided the architecture is x86 or AMD64.
231
232 - Added missing `?Sized` bound to `B` on the implementation of
233 `Arbitrary` for `std::borrow::Cow<'_, B>`.
234
235 ### Bug Fixes
236
237 - `prop_assert!` and `prop_assume!` should now be usable in `no_std`
238 environments.
239
240 ### Other Notes
241
242 - `rusty_fork` has been bumped to 0.3.0, which adds support for a number of
243 [new test flags](https://github.com/AltSysrq/rusty-fork/blob/master/CHANGELOG.md#improvements)
244 when running forked tests.
245
246 - The `PassThrough` RNG algorithm now returns 0 instead of panicking when it
247 runs out of entropy.
248
249 ## 0.9.6
250
251 ### Bug Fixes
252
253 - Fixed [#186](https://github.com/proptest-rs/proptest/issues/186),
254 a Rust future-compatibility issue.
255
256 ## 0.9.5
257
258 ### Bug Fixes
259
260 - Fixed a Rust future-compatibility issue (https://github.com/rust-lang/rust/pull/65819).
261
262 ### New Additions
263
264 ## 0.9.4
265
266 ### Bug Fixes
267
268 - The `unstable` feature one again works against the latest nightly.
269
270 ### Performance Improvements
271
272 - Unions and the `prop_oneof!` combinator now generate value trees
273 lazily.
274
275 In previous versions of `proptest`, if a value tree for a
276 union variant was generated, so would value trees for earlier
277 variants -- as a result, union value tree generation was linear in the
278 number of variants.
279
280 In `proptest` 0.9.4 and above, value trees are only generated for
281 union variants that are picked. Union value tree generation is now
282 independent of the number of variants.
283
284 ### Deprecations
285
286 - `TupleUnion` has been deprecated, and its implementation will be
287 replaced by `LazyTupleUnion`'s in 0.10.0.
288
289 ### Other Notes
290
291 - The return type of `prop_oneof!` has changed from `TupleUnion` to
292 `LazyTupleUnion`. `prop_oneof!`'s return type is documented to not be
293 stable, and that continues to be the case.
294
295 - Shrinking is now limited to four times as many iterations as configured
296 number of test cases by default.
297
298 - `prop_assert_eq!` and `prop_assert_ne!` produce output more similar to the
299 `assert_eq!` and `assert_ne!` macros. This should also make it easier to
300 visually parse out the source location in the resulting messages.
301
302 ## 0.9.3
303
304 This is a minor release to correct some packaging errors. The license files are
305 now included in the files published to crates.io, and some unneeded files are
306 now excluded.
307
308 ## 0.9.2
309
310 ### New Additions
311
312 - Closures generated by `prop_compose!` are now `move`. This is not expected to
313 cause any breakage since there is no way to successfully use a borrowing
314 closure with that macro.
315
316 - There is now **highly experimental** support for building on Web Assembly.
317 Refer to [the Proptest
318 book](https://altsysrq.github.io/proptest-book/proptest/wasm.html) for build
319 instructions.
320
321 ### Other Notes
322
323 - Using proptest with the default `std` feature enabled, the `spin` crate is no
324 longer brought in as a dependency.
325
326 - Using proptest with the `std` feature disabled, neither `spin` nor
327 `lazy_static` are brought in as dependencies.
328
329 ## 0.9.1
330
331 ### New RNG Algorithm
332
333 Starting in this version, the default RNG algorithm has been changed from
334 XorShift to ChaCha since it produces higher-quality randomness. This may make
335 test case generation a bit slower but it avoids certain pathological cases that
336 the old generator had.
337
338 The old algorithm is still supported, and is used automatically when reading
339 old failure persistence files.
340
341 Note that this change also affects the internal representation of RNG seeds,
342 which affects the `FailurePersistence` trait which previously only supported
343 the seed representation for XorShift. This release maintains source
344 compatibility with 0.9.0 by providing defaults for the new methods which
345 delegate (when possible) to the old ones, but be aware that custom failure
346 persistence implementations using the old API will not function when using an
347 RNG other than XorShift.
348
349 To keep using the old algorithm, you can set the environment variable
350 `PROPTEST_RNG_ALGORITHM` to `xs` or set `Config.rng_algorithm` to
351 `RngAlgorithm::XorShift` in code.
352
353 Besides ChaCha, this version also adds a `PassThrough` RNG "algorithm" which
354 makes it possible to use an external source of entropy with Proptest.
355
356 ### New Additions
357
358 - `TestRng` instances can be created with the `from_seed` function.
359
360 - `TestRunner` instances can be created with user-provided `TestRng`s.
361
362 - `TestRunner` now has a `deterministic()` constructor which uses the same RNG
363 every time, to facilitate doing statistical tests on strategy outputs.
364
365 - There is now a work-around for a [compiler
366 bug](https://github.com/rust-lang/rust/issues/52478) which prevents building
367 with `-C link-dead-code`. Please see this issue for details:
368 https://github.com/proptest-rs/proptest/issues/124
369
370 ### Deprecations
371
372 - The `load_persisted_failures` and `save_persisted_failure` methods on the
373 `FailurePersistence` trait have been deprecated and will be removed in
374 0.10.0.
375
376 ## 0.9.0
377
378 ### Breaking Changes
379
380 - The minimum Rust version has been increased to 1.32.0.
381
382 - The version of the `rand` crate has been increased to 0.6.
383
384 - The `ValueFor` type alias (deprecated in 0.8.0) has been removed. Replace
385 `ValueFor<S>` with `S::Value` or `<S as Strategy>::Value` as necessary.
386
387 - `From<SizeRange>` implementations converting a `SizeRange` back to various
388 std types have been removed since they were of limited utility and had
389 unclear or incorrect conversion properties.
390
391 - Many optional elements (such as trailing commas or function visibility
392 modifiers) in certain macros could be specified more than once. The macros
393 now accept at most one occurrence.
394
395 - Visibility modifiers inside `prop_compose` must no longer be enclosed in
396 brackets. Unless other modifiers (e.g., `unsafe`) are also in use, simply
397 removing the brackets is sufficient.
398
399 ### New Additions
400
401 - Rust 2018 style macro imports are now supported.
402
403 - In a Rust 2018 crate, all the macros can be brought into scope with
404 `import proptest::prelude::*;`.
405
406 - The proptest macros now accept trailing commas in more locations.
407
408 - Visibility modifiers can now be passed to `prop_compose!` without enclosing
409 them in brackets. Unfortunately, the old way could not continue to be
410 supported due to the way the `vis` macro matcher works.
411
412 ### Nightly-only breakage
413
414 - The `nightly` feature, which was formerly required for using proptest with
415 `#[no_std]`, has been removed. References to the feature can simply be
416 deleted.
417
418 - When using the `unstable` feature and setting `default-features = false`, the
419 `AtomicI64` and `AtomicU64` types are not supported unless the `atomic64bit`
420 feature is enabled. This supports `no_std` usage on platforms which do not
421 support atomic 64-bit operations.
422
423 ### Other Notes
424
425 - Generated strings are now much more likely to contain right-to-left override
426 characters.
427
428 - Most of the crate-level documentation has been relocated to the [Proptest
429 Book](https://altsysrq.github.io/proptest-book/proptest/index.html).
430
431 ## 0.8.7
432
433 ### New Additions
434
435 - Add `max_shrink_iters` and `max_shrink_time` options to test configuration to
436 allow capping the resources expended on shrinking test cases.
437
438 - Add `verbose` option to make proptest give details about what is happening as
439 the test executes.
440
441 - When a failure is saved to the persistence file, the message now also
442 includes the seed that was saved so that it can manually be added to the
443 appropriate file should the test have run somewhere where the updated file is
444 not accessible (for example, on a CI system).
445
446 ### Bug Fixes
447
448 - `any::<SystemTime>()` now generates random values centred on the UNIX epoch
449 rather than always producing the current time.
450
451 ### Other Notes
452
453 - When using forking, proptest will now detect conditions which cause the child
454 process to crash without running any tests, and will fail quickly instead of
455 respawning child processes.
456
457 ## 0.8.6
458
459 ### New Additions
460
461 - `Vec<S> where S: Strategy` is now itself a `Strategy` for producing
462 fixed-size `Vec`s whose values are derived from the respective strategies.
463
464 - It is now possible to configure the test runner to cache test results to
465 avoid spending time running identical tests. See `Config.result_cache`.
466
467 - Add `sample::Index`, a type for generating indices into runtime-sized slices
468 and vectors.
469
470 - Add `sample::Selector`, a type for picking items out of dynamically-created
471 iterables.
472
473 ### Bug Fixes
474
475 - Fix panic when using `sample::subsequence` with an empty vector.
476
477 - Fix panic when using `sample::subsequence` with a size equal to the size of
478 the input vector.
479
480 - Fix sampled bitset strategies on integers not allowing to generate exactly
481 the same number of bits as the integer is wide.
482
483 ### Other Notes
484
485 - Passing empty size ranges to functions requiring a non-empty size range now
486 panic with an explicit message immediately rather than causing an arithmetic
487 error when generating input values.
488
489 - There were a few cases where proptest would accept a `SizeRange` with an
490 inclusive maximum value of `usize::MAX`. Size ranges are now always clamped
491 to `usize::MAX - 1`.
492
493 ## 0.8.5
494
495 ### Bug Fixes
496
497 - Fix build when nightly features are enabled.
498
499 ## 0.8.4
500
501 ### Bug Fixes
502
503 - Nightly and no_std support work against latest nightly once again.
504
505 ### New Additions
506
507 - Added `bits::bool_vec` for generating `Vec<bool>` as a bit set.
508
509 ### Nightly-only breakage
510
511 - `impl Arbitrary for CollectionAllocErr` is temporarily removed pending it
512 being available outside the `alloc` crate again.
513
514 - `bits::bitset` is no longer available without the `bit-set` feature (enabled
515 by default), which is [not compatible with `#[no_std]`
516 environments](https://github.com/contain-rs/bit-vec/pull/51).
517
518 ## 0.8.3
519
520 ### Bug Fixes
521
522 - Fix that regex-based string generation could transpose the order of a literal
523 and a non-literal component.
524
525 ## 0.8.2
526
527 ### New Additions
528
529 - Macros which previously accepted `pattern in strategy` syntax to specify
530 arguments now also accept `pattern: type` syntax as shorthand for
531 `pattern in any::<type>()`.
532
533 - Closure-style `proptest!` invocation no longer requires the body to use block
534 syntax.
535
536 - Closure-style `proptest!` invocation now accepts custom configurations.
537
538 ## 0.8.1
539
540 ### New Additions
541
542 - `proptest!` now has form that accepts a closure. See the documentation for
543 the macro for more details.
544
545 ### Bug Fixes
546
547 - Fix spurious warning about corrupt regression files. The files were not
548 corrupt but the parser was failing to handle the blank line at the end.
549
550 - The `multiplex_alloc!` and `multiplex_core!` macros which were
551 unintentionally exported in 0.8.0 are no longer exported. This is not
552 considered a breaking change since they were not supposed to be accessible,
553 and in any case would not have expanded into valid code in most other crates.
554
555 ## 0.8.0
556
557 ### New Additions
558
559 - A combinator `.prop_filter_map` has been added to `Strategy`.
560 It is similar to `.filter_map` for `Iterator` in that it is the
561 combination of `.prop_filter` and `.prop_map`.
562
563 - `i128` and `u128` are now supported without any feature flags and on stable.
564
565 - More implementations of `Arbitrary` are supported for `alloc` + `no_std` users.
566
567 - `size_range` now accepts inclusive ranges of form `low..=high` and `..=high`.
568 Thus, you can construct a `vec` strategy as: `vec(elt_strategy, low..=high)`
569 and `vec(elt_strategy, ..=high)`. This also applies to other functions
570 accepting `Into<SizeRange>`.
571
572 - `..= high` is now a valid strategy. Please note that `..= 1` will naturally
573 include numbers lower than `0` for sized types.
574
575 - `low..=high` is also a valid strategy.
576
577 - `Arbitrary` is implemented for `RangeInclusive<Idx>`, `RangeToInclusive`,
578 and `DecodeUtf16` on stable.
579
580 - Bitset strategies and `subsequence` now accept all range syntaxes.
581
582 ### Bug Fixes
583
584 - Fix a race condition where a test failing due to running ever so slightly
585 over the set timeout could cause the test harness to converge to the
586 incorrect failing value, a non-failing value, or panic.
587
588 ### Deprecations
589
590 - The type alias `ValueFor<S>` is now deprecated and will be removed in
591 version 0.9. You should just use `S::Value` instead.
592
593 ### Breaking changes
594
595 - A minimum version of 1.27 of Rust is now required.
596
597 - `regex-syntax` version 0.6 is now used.
598
599 - `rand` version 0.5 is now used.
600
601 - As a consequence, the `FailurePersistence` trait will now use `[u8; 16]` seeds
602 instead of `[u32; 4]`. However, the stored failure persistence files using
603 the default `FileFailurePersistence` will still use `[u32; 4]` so your old
604 failure persistence files should still work.
605
606 - The RNG used by proptest has been changed to a PRNG `TestRng` which proptest
607 exposes. This is currently a simple new-type wrapper around `XorShiftRng`.
608 In the future, this will give us more freedom to make changes without breakage.
609
610 - The feature flag `i128_support` has been removed. The features it added are
611 now always supported.
612
613 - The associated type `Value` of `Strategy` has been renamed to `Tree`.
614 A new associated type `Value` has been added to `Strategy` which always refers
615 to the same type as `<S::Tree as ValueTree>::Value` for some strategy `S`.
616 This change allows you to write `-> impl Strategy<Value = T>` for functions
617 returning a `Strategy` generating `T`s. This is more ergonomic to use than
618 `-> impl Strategy<Value = impl ValueTree<Value = T>>`.
619
620 - The method `new_value` in `Strategy` has been renamed to `new_tree` to mirror
621 the renaming of `Value` to `Tree`.
622
623 - As a consequence change, the associated type `ValueTree` has been removed from
624 `Arbitrary`.
625
626 - The methods `run` and `run_one` on `TestRunner` now takes a function-under-test
627 that accepts the generated type by value instead of by reference instead.
628 This means that you don't need to write `ref value in my_strategy` and can
629 write `value in my_strategy` instead even if `typeof(value)` doesn't implement
630 `Copy`. This is also a step in the direction of allowing strategies to generate
631 references when generic associated types (GATs) land.
632 However, `ref value in my_strategy` will still be accepted, so not a lot of
633 breakage should come of this if you've used `proptest! { .. }`.
634
635 - `prop_compose!` no longer applies `.boxed()` to the strategy produced.
636 Therefore, `-> BoxedStrategy<T>` is no longer the correct type.
637 The new return type is `-> impl Strategy<Value = T>`.
638 If you want the old behaviour, you can use `.boxed()` yourself.
639
640 - `Arbitrary` for `SizeRange` changed its associated type to use `RangeInclusive`.
641 Same applies for `CString`.
642
643 - Many APIs now use `impl Trait` in argument position, which could affect code
644 using turbofishes to specify types explicitly.
645
646 - `char` APIs which formerly represented a range as `(start, end)` now require
647 `start..=end`.
648
649 ### Nightly-only breakage
650
651 - As `std::io::{Chars, CharsError}` have been deprecated on nightly,
652 their `Arbitrary` implementations have been removed.
653
654 ## 0.7.2
655
656 ### Bug Fixes
657
658 - Fix that `bool` would not shrink correctly, leading to hangs when tests
659 taking `bool` parameters would fail in certain circumstances.
660
661 ## 0.7.1
662
663 ### New Additions
664
665 - It is now possible to run test cases in sub-processes. This allows using
666 proptest to test functions which may cause the test process to terminate
667 abruptly, such as by calling `abort()` or even suffering a segmentation
668 fault. This requires the "fork" feature, enabled by default.
669
670 - Added support for setting a timeout which applies on a per-test-case (i.e.,
671 single input rather than the whole test) basis. This allows using proptest to
672 find inputs which cause code to get stuck in infinite loops or exhibit other
673 pathological performance behaviour. This requires the "timeout" feature (and
674 transitively, the "fork" feature), enabled by default.
675
676 See also [the documentation](README.md#forking-and-timeouts) for these
677 features.
678
679 ### Bug Fixes
680
681 - Fix that failure persistence file would be written to the incorrect location
682 in projects using workspaces. See
683 [#24](https://github.com/proptest-rs/proptest/issues/24) for more details and
684 instructions on how to migrate any persistence files that had been written to
685 the wrong location.
686
687 - Fix a case where `any::<ArgsOs>()` or `any::<VarsOs>()` could panic on
688 Windows.
689
690 ### Nightly-only breakage
691
692 - Support for the `hashmap_core` crate is removed pending
693 https://github.com/Amanieu/hashmap_core/issues/3.
694
695 ## 0.7.0
696
697 ### Potential Breaking Changes
698
699 - The persistence system has been refactored to allow for
700 non-file-system based persistence. `FailurePersistence`
701 is now a trait, and the prior file-based enum which fulfilled
702 that purpose is now called `FileFailurePersistence` and implements
703 the generic trait. The default behavior has not changed.
704
705 - Reflecting the change to persistence, `Config.failure_persistence`
706 is now of type `Option<Box<FailurePersistence>>`.
707
708 - The `source_file` used as an optional reference point to the location of the
709 calling test is now tracked on the `Config` struct rather than the
710 `TestRunner`.
711
712 ### New Additions
713
714 - Experimental support on nightly for working in `#![no_std]` environments has
715 been added. To use it, one must disable the default-features for proptest and
716 use the new "alloc" and "nightly" features. Currently access to a heap
717 allocator is still required.
718
719 ## 0.6.0
720
721 ### Potential Breaking Changes
722
723 - There is a small change of breakage if you've relied on `Recursive` using an
724 `Arc<BoxedStrategy<T>>` as `Recursive` now internally uses `BoxedStrategy<T>`
725 instead as well as expecting a `Fn(BoxedStrategy<T>) -> R` instead of
726 `Fn(Arc<BoxedStrategy<T>>) -> R`. In addition, the type of recursive
727 strategies has changed from `Recursive<BoxedStrategy<T>, F>` to just
728 `Recursive<T, F>`.
729
730 ### Minor changes
731
732 - Reduced indirections and heap allocations inside `Recursive<T, F>` somewhat.
733
734 - `BoxedStrategy<T>` and `SBoxedStrategy<T>` now use `Arc` internally instead of
735 using `Box`. While this has marginal overhead, it also reduces the overhead
736 in `Recursive<T, F>`. The upside to this change is also that you can very
737 cheaply clone strategies.
738
739 - `Filter` is marginally faster.
740
741 ### Bug Fixes
742
743 - Removed `impl Arbitrary for LocalKeyState` since `LocalKeyState` no longer
744 exists in the nightly compiler.
745
746 - Unstable features compile on latest nightly again.
747
748 ## 0.5.1
749
750 ### New Additions
751
752 - `proptest::strategy::Union` and `proptest::strategy::TupleUnion` now work
753 with weighted strategies even if the sum of the weights overflows a `u32`.
754
755 - Added `SIGNALING_NAN` strategy to generate signalling NaNs if supported by
756 the platform. Note that this is _not_ included in `ANY`.
757
758 ### Bug Fixes
759
760 - Fixed values produced via `prop_recursive()` not shrinking from the recursive
761 to the non-recursive case.
762
763 - Fix that `QUIET_NAN` would generate signalling NaNs on most platforms on Rust
764 1.24.0 and later.
765
766 ## 0.5.0
767
768 ### Potential Breaking Changes
769
770 - There is a small chance of breakage if you've relied on the constraints put
771 on type inference by the closure in `leaf.prop_recursive(..)` having a fixed
772 output type. The output type is now any strategy that generates the same type
773 as `leaf`. This change is intended to make working with recursive types a bit
774 easier as you no longer have to use `.boxed()` inside the closure you pass to
775 `.prop_recursive(..)`.
776
777 - There is a small chance of breakage wrt. type inference due to the
778 introduction of `SizeRange`.
779
780 - There is a small chance of breakage wrt. type inference due to the
781 introduction of `Probability`.
782
783 - `BoxedStrategy` and `SBoxedStrategy` are now newtypes instead of being type
784 aliases. You will only experience breaking changes if you've directly
785 used `.boxed()` and not `(S)BoxedStrategy<T>` but rather
786 `Box<Strategy<Value = Box<ValueTree<Value = T>>>>`. The probability of
787 breakage is very small, but still possible. The benefit of this change
788 is that calling `.boxed()` or `.sboxed()` twice only boxes once. This can
789 happen in situations where you have functions `Strategy -> BoxedStrategy` or
790 with code generation.
791
792 - `proptest::char::ANY` has been removed. Any remaining uses must be replaced
793 by `proptest::char::any()`.
794
795 - `proptest::strategy::Singleton` has been removed. Any remaining uses must be
796 replaced by `proptest::strategy::Just`.
797
798 ### New Additions
799
800 - Proptest now has an `Arbitrary` trait in `proptest::arbitrary` and re-exported
801 in the `proptest::prelude`. `Arbitrary` has also been `impl`emented for most
802 of the standard library. The trait provides a mechanism to define a canonical
803 `Strategy` for a given type just like `Arbitrary` in Haskell's QuickCheck.
804 Deriving for this trait will also be provided soon in the crate
805 `proptest_derive`. To use the canonical strategy for a certain type `T`,
806 you can simply use `any::<T>()`. This is the major new addition of this release.
807
808 - The `any_with`, `arbitrary`, `arbitrary_with` free functions in
809 the module `proptest::arbitrary`.
810
811 - The `ArbitraryF1` and `ArbitraryF2` traits in `proptest::arbitrary::functor`.
812 These are "higher order" `Arbitrary` traits that correspond to the `Arbitrary1`
813 and `Arbitrary2` type classes in Haskell's QuickCheck. They are mainly provided
814 to support a common set of container-like types in custom deriving self-recursive
815 types in `proptest_derive`. More on this later releases.
816
817 - The strategies in `proptest::option` and `proptest::result` now accept a type
818 `Probability` which is a wrapper around `f64`. Conversions from types such as
819 `f64` are provided to make the interface ergonomic to use. Users may also use
820 the `proptest::option::prob` function to explicitly construct the type.
821
822 - The strategies in `proptest::collections` now accept a type `SizeRange`
823 which is a wrapper around `Range<usize>`. Conversions from types
824 such as `usize` and `Range<usize>` are provided to make the interface
825 ergonomic to use. Users may also use the `proptest::collections::size_bounds`
826 function to explicitly construct the type.
827
828 - A `.prop_map_into()` operation on all strategies that map
829 using `Into<OutputType>`. This is a clearer and cheaper
830 operation than using `.prop_map(OutputType::from)`.
831
832 - A nonshrinking `LazyJust` strategy that can be used instead of `Just` when you
833 have non-`Clone` types.
834
835 - Anything that can be coerced to `fn() -> T` where `T: Debug` is a `Strategy`
836 where `ValueFor<fn() -> T> == T`. This is intended to make it easier to reuse
837 proptest for unit tests with manual input space partition where `fn() -> T`
838 provides fixtures.
839
840 ### Minor changes
841
842 - Relaxed the constraints of `btree_map` removing `'static`.
843
844 - Reduced the heap allocation inside `Recursive` somewhat.
845
846 ## 0.4.2
847
848 ### Bug Fixes
849
850 - The `unstable` feature now works again.
851
852 ## 0.4.1
853
854 ### New Additions
855
856 - The `proptest::num::f32` and `proptest::num::f64` modules now have additional
857 constants (e.g., `POSITIVE`, `SUBNORMAL`, `INFINITE`) which can be used to
858 generate subsets of the floating-point domain by class and sign.
859
860 ### Bug Fixes
861
862 - `proptest::num::f32::ANY` and `proptest::num::f64::ANY` now actually produce
863 arbitrary values. Previously, they had the same effect as `0.0..1.0`. While
864 this fix is a very substantial change in behaviour, it was not considered a
865 breaking change since (a) the new behaviour is consistent with the
866 documentation and expectations, (b) it's quite unlikely anyone was depending
867 on the old behaviour since anyone who wanted that range would have written it
868 out, and (c) Proptest isn't generally a transitive dependency so the chance
869 of this update happening "by surprise" is low.
870
871 ## 0.4.0
872
873 ### Deprecations and Potential Breaking Changes
874
875 - `proptest::char::ANY` replaced with `proptest::char::any()`.
876 `proptest::char::ANY` is present but deprecated, and will be removed in
877 proptest 0.5.0.
878
879 - Instead of returning `-> Result<Self::Value, String>`, strategies are
880 expected to return `-> Result<Self::Value, Reason>` instead. `Reason` reduces
881 the amount of heap allocations, especially for `.prop_filter(..)` where you
882 may now also pass in `&'static str`. You will only experience breaks if
883 you've written your own strategy types or if you've used
884 `TestCaseError::Reject` or `TestCaseError::Fail` explicitly.
885
886 - Update of externally-visible crate `rand` to `0.4.2`.
887
888 ### New Additions
889
890 - Added `proptest::test_runner::Reason` which allows you to avoid heap
891 allocation in some places and may be used to make the API richer in the
892 future without incurring more breaking changes.
893
894 - Added a type alias `proptest::strategy::NewTree<S>` where `S: Strategy`
895 defined as: `type NewTree<S> = Result<<S as Strategy>::Value, Rejection>`.
896
897 ## 0.3.4
898
899 ### Bug Fixes
900
901 - Cases where `file!()` returns a relative path, such as on Windows, are now
902 handled more reasonably. See
903 [#24](https://github.com/proptest-rs/proptest/issues/24) for more details and
904 instructions on how to migrate any persistence files that had been written to
905 the wrong location.
906
907 ## 0.3.3
908
909 Boxing Day Special
910
911 ### New Additions
912
913 - Added support for `i128` and `u128`. Since this is an unstable feature in
914 Rust, this is hidden behind the feature `unstable` which you have to
915 explicitly opt into in your `Cargo.toml` file.
916
917 - Failing case persistence. By default, when a test fails, Proptest will now
918 save the seed for the failing test to a file, and later runs will test the
919 persisted failing cases before generating new ones.
920
921 - Added `UniformArrayStrategy` and helper functions to simplify generating
922 homogeneous arrays with non-`Copy` inner strategies.
923
924 - Trait `rand::Rng` and struct `rand::XorShiftRng` are now included in
925 `proptest::prelude`.
926
927 ### Bug Fixes
928
929 - Fix a case where certain combinations of strategies, like two
930 `prop_shuffle()`s in close proximity, could result in low-quality randomness.
931
932 ## 0.3.2
933
934 ### New Additions
935
936 - Added `SampledBitSetStrategy` to generate bit sets based on size
937 distribution.
938
939 - Added `Strategy::sboxed()` and `SBoxedStrategy` to make `Send + Sync` boxed
940 strategies.
941
942 - `RegexGeneratorStrategy` is now `Send` and `Sync`.
943
944 - Added a type alias `ValueFor<S>` where `S: Strategy`. This is a shorter way
945 to refer to: `<<S as Strategy>::Value as ValueTree>::Value`.
946
947 - Added a type alias `type W<T> = (u32, T)` for a weighted strategy `T` in the
948 context of union strategies.
949
950 - `TestRunner` now implements `Default`.
951
952 - Added `Config::with_cases(number_of_cases: u32) -> Config` for simpler
953 construction of a `Config` that only differs by the number of test cases.
954
955 - All default fields of `Config` can now be overridden by setting environment
956 variables. See the docs of that struct for more details.
957
958 - Bumped dependency `rand = "0.3.18"`.
959
960 - Added `proptest::sample::subsequence` which returns a strategy generating
961 subsequences, of the source `Vec`, with a size within the given `Range`.
962
963 - Added `proptest::sample::select` which returns a strategy selecting exactly
964 one value from another collection.
965
966 - Added `prop_perturb` strategy combinator.
967
968 - Added `strategy::check_strategy_sanity()` function to do sanity checks on the
969 shrinking implementation of a strategy.
970
971 - Added `prop_shuffle` strategy combinator.
972
973 - Added `strategy::Fuse` adaptor.
974
975 ### Bug Fixes
976
977 - Fix bug where `Vec`, array and tuple shrinking could corrupt the state of
978 their inner values, for example leading to out-of-range integers.
979
980 - Fix bug where `Flatten` (a.k.a. the `prop_flat_map` combinator) could fail to
981 converge to a failing test case during shrinking.
982
983 - Fix `TupleUnion` sometimes panicking during shrinking if there were more than
984 two choices.
985
986 ## 0.3.1
987
988 ### New Additions
989
990 - Added `CharStrategy::new_borrowed`.
991
992 ## 0.3.0
993
994 ### New Additions
995
996 - `Union` now supports weighting via `Union::new_weighted`. Corresponding
997 syntax to specify weights is also available in `prop_oneof!`.
998
999 - Added `TupleUnion`, which works like `Union` but permits doing static
1000 dispatch even with heterogeneous delegate strategies.
1001
1002 - `prop_oneof!` is smarter about how it combines the input strategies.
1003
1004 - Added `option` module to generate weighted or unweighted `Option` types.
1005
1006 - Added `result` module to generate weighted or unweighted `Result` types.
1007
1008 - All `bits` submodules now have a `masked` function to create a strategy for
1009 generating subsets of an arbitrary bitmask.
1010
1011 ### Potential Breaking Changes
1012
1013 - `Union::new` now has a generic argument type which could impact type
1014 inference.
1015
1016 - The concrete types produced by `prop_oneof!` have changed.
1017
1018 - API functions which used to return `BoxedStrategy` now return a specific
1019 type.
1020
1021 - `BitSetStrategy<T>` is no longer `Copy` for non-`Copy` types `T` nor `Debug`
1022 for non-`Debug` types `T`.
1023
1024 - `BitSetLike::max` has been renamed to `BitSetLike::len`.
1025
1026 ## 0.2.1
1027
1028 ### New Additions
1029
1030 - Added `prop_assert!` macro family to assert without panicking, for quieter
1031 test failure modes.
1032
1033 - New `prelude` module for easier importing of important things.
1034
1035 - Renamed `Singleton` to `Just`. (The old name is still available.)
1036
1037 - Failure messages produced by `proptest!` are now much more readable.
1038
1039 - Added in-depth tutorial.
1040
1041 ## 0.2.0
1042
1043 ### Breaking Changes
1044
1045 - `Strategy` now requires `std::fmt::Debug`.
1046
1047 ### New Additions
1048
1049 - `Strategy` now has a family of `prop_flat_map()` combinators for producing
1050 dynamic and higher-order strategies.
1051
1052 - `Strategy` has a `prop_recursive()` combinator which allows generating
1053 recursive structures.
1054
1055 - Added `proptest::bool::weighted()` to pull booleans from a weighted
1056 distribution.
1057
1058 - New `prop_oneof!` macro makes it easier to select from one of several
1059 strategies.
1060
1061 - New `prop_compose!` macro to simplify writing most types of custom
1062 strategies.
1063
1064 ## 0.1.1
1065
1066 ### New Additions
1067
1068 Add `strategy::NoShrink`, `Strategy::no_shrink()`.