Skip to content

Commit 7d09f17

Browse files
committed
Auto merge of #6753 - Eh2406:proptest, r=dwijnand
Proptest 0.9.1 This is a rework of #6636 now possible do to the change in testing from #6748
2 parents a6d672b + 9a8321a commit 7d09f17

File tree

4 files changed

+16
-30
lines changed

4 files changed

+16
-30
lines changed

Diff for: .travis.yml

-14
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,6 @@ matrix:
2323
rust: beta
2424
if: branch != master OR type = pull_request
2525

26-
# Minimum Rust supported channel. We enable these to make sure we
27-
# continue to work on the advertised minimum Rust version.
28-
# However cargo only supports the latest stable so this will get
29-
# increased every 6 weeks or so when the first PR to use a new feature.
30-
- env: TARGET=x86_64-unknown-linux-gnu
31-
ALT=i686-unknown-linux-gnu
32-
rust: 1.31.0
33-
script:
34-
- rustup toolchain install nightly || travis_terminate 1
35-
- cargo +nightly generate-lockfile -Z minimal-versions || travis_terminate 1
36-
- cargo -V || travis_terminate 1
37-
- cargo test --features=deny-warnings || travis_terminate 1
38-
if: branch != master OR type = pull_request
39-
4026
- env: TARGET=x86_64-unknown-linux-gnu
4127
ALT=i686-unknown-linux-gnu
4228
rust: nightly

Diff for: Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ features = [
100100

101101
[dev-dependencies]
102102
bufstream = "0.1"
103-
proptest = "0.8.7"
103+
proptest = "0.9.1"
104104

105105
[[bin]]
106106
name = "cargo"

Diff for: tests/testsuite/resolve.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ use crate::support::project;
88
use crate::support::registry::Package;
99
use crate::support::resolver::{
1010
assert_contains, assert_same, dep, dep_kind, dep_loc, dep_req, dep_req_kind, loc_names, names,
11-
pkg, pkg_dep, pkg_id, pkg_loc, registry, registry_strategy, remove_dep, resolve, resolve_and_validated,
12-
resolve_with_config, PrettyPrintRegistry, ToDep, ToPkgId,
11+
pkg, pkg_dep, pkg_id, pkg_loc, registry, registry_strategy, remove_dep, resolve,
12+
resolve_and_validated, resolve_with_config, PrettyPrintRegistry, ToDep, ToPkgId,
1313
};
1414

15-
use proptest::{prelude::*, *};
15+
use proptest::prelude::*;
1616

1717
// NOTE: proptest is a form of fuzz testing. It generates random input and makes sure that
1818
// certain universal truths are upheld. Therefore, it can pass when there is a problem,
@@ -107,7 +107,7 @@ proptest! {
107107
#[test]
108108
fn removing_a_dep_cant_break(
109109
PrettyPrintRegistry(input) in registry_strategy(50, 20, 60),
110-
indexes_to_remove in collection::vec((any::<prop::sample::Index>(), any::<prop::sample::Index>()), ..10)
110+
indexes_to_remove in prop::collection::vec((any::<prop::sample::Index>(), any::<prop::sample::Index>()), ..10)
111111
) {
112112
let reg = registry(input.clone());
113113
let mut removed_input = input.clone();
@@ -149,7 +149,7 @@ proptest! {
149149
#[test]
150150
fn limited_independence_of_irrelevant_alternatives(
151151
PrettyPrintRegistry(input) in registry_strategy(50, 20, 60),
152-
indexes_to_unpublish in collection::vec(any::<prop::sample::Index>(), ..10)
152+
indexes_to_unpublish in prop::collection::vec(any::<prop::sample::Index>(), ..10)
153153
) {
154154
let reg = registry(input.clone());
155155
// there is only a small chance that any one

Diff for: tests/testsuite/support/resolver.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -508,18 +508,18 @@ pub fn registry_strategy(
508508

509509
/// This test is to test the generator to ensure
510510
/// that it makes registries with large dependency trees
511-
///
512-
/// This is a form of randomized testing, if you are unlucky it can fail.
513-
/// A failure on its own is not a big deal. If you did not change the
514-
/// `registry_strategy` then feel free to retry without concern.
515511
#[test]
516512
fn meta_test_deep_trees_from_strategy() {
517513
let mut dis = [0; 21];
518514

519515
let strategy = registry_strategy(50, 20, 60);
516+
let mut test_runner = TestRunner::deterministic();
520517
for _ in 0..128 {
521518
let PrettyPrintRegistry(input) = strategy
522-
.new_tree(&mut TestRunner::default())
519+
.new_tree(&mut TestRunner::new_with_rng(
520+
Default::default(),
521+
test_runner.new_rng(),
522+
))
523523
.unwrap()
524524
.current();
525525
let reg = registry(input.clone());
@@ -547,18 +547,18 @@ fn meta_test_deep_trees_from_strategy() {
547547

548548
/// This test is to test the generator to ensure
549549
/// that it makes registries that include multiple versions of the same library
550-
///
551-
/// This is a form of randomized testing, if you are unlucky it can fail.
552-
/// A failure on its own is not a big deal. If you did not change the
553-
/// `registry_strategy` then feel free to retry without concern.
554550
#[test]
555551
fn meta_test_multiple_versions_strategy() {
556552
let mut dis = [0; 10];
557553

558554
let strategy = registry_strategy(50, 20, 60);
555+
let mut test_runner = TestRunner::deterministic();
559556
for _ in 0..128 {
560557
let PrettyPrintRegistry(input) = strategy
561-
.new_tree(&mut TestRunner::default())
558+
.new_tree(&mut TestRunner::new_with_rng(
559+
Default::default(),
560+
test_runner.new_rng(),
561+
))
562562
.unwrap()
563563
.current();
564564
let reg = registry(input.clone());

0 commit comments

Comments
 (0)