Skip to content

Commit

Permalink
Auto merge of #6753 - Eh2406:proptest, r=dwijnand
Browse files Browse the repository at this point in the history
Proptest 0.9.1

This is a rework of #6636 now possible do to the change in testing from #6748
  • Loading branch information
bors committed Mar 16, 2019
2 parents a6d672b + 9a8321a commit 7d09f17
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 30 deletions.
14 changes: 0 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,6 @@ matrix:
rust: beta
if: branch != master OR type = pull_request

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

- env: TARGET=x86_64-unknown-linux-gnu
ALT=i686-unknown-linux-gnu
rust: nightly
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ features = [

[dev-dependencies]
bufstream = "0.1"
proptest = "0.8.7"
proptest = "0.9.1"

[[bin]]
name = "cargo"
Expand Down
10 changes: 5 additions & 5 deletions tests/testsuite/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ use crate::support::project;
use crate::support::registry::Package;
use crate::support::resolver::{
assert_contains, assert_same, dep, dep_kind, dep_loc, dep_req, dep_req_kind, loc_names, names,
pkg, pkg_dep, pkg_id, pkg_loc, registry, registry_strategy, remove_dep, resolve, resolve_and_validated,
resolve_with_config, PrettyPrintRegistry, ToDep, ToPkgId,
pkg, pkg_dep, pkg_id, pkg_loc, registry, registry_strategy, remove_dep, resolve,
resolve_and_validated, resolve_with_config, PrettyPrintRegistry, ToDep, ToPkgId,
};

use proptest::{prelude::*, *};
use proptest::prelude::*;

// NOTE: proptest is a form of fuzz testing. It generates random input and makes sure that
// certain universal truths are upheld. Therefore, it can pass when there is a problem,
Expand Down Expand Up @@ -107,7 +107,7 @@ proptest! {
#[test]
fn removing_a_dep_cant_break(
PrettyPrintRegistry(input) in registry_strategy(50, 20, 60),
indexes_to_remove in collection::vec((any::<prop::sample::Index>(), any::<prop::sample::Index>()), ..10)
indexes_to_remove in prop::collection::vec((any::<prop::sample::Index>(), any::<prop::sample::Index>()), ..10)
) {
let reg = registry(input.clone());
let mut removed_input = input.clone();
Expand Down Expand Up @@ -149,7 +149,7 @@ proptest! {
#[test]
fn limited_independence_of_irrelevant_alternatives(
PrettyPrintRegistry(input) in registry_strategy(50, 20, 60),
indexes_to_unpublish in collection::vec(any::<prop::sample::Index>(), ..10)
indexes_to_unpublish in prop::collection::vec(any::<prop::sample::Index>(), ..10)
) {
let reg = registry(input.clone());
// there is only a small chance that any one
Expand Down
20 changes: 10 additions & 10 deletions tests/testsuite/support/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,18 +508,18 @@ pub fn registry_strategy(

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

let strategy = registry_strategy(50, 20, 60);
let mut test_runner = TestRunner::deterministic();
for _ in 0..128 {
let PrettyPrintRegistry(input) = strategy
.new_tree(&mut TestRunner::default())
.new_tree(&mut TestRunner::new_with_rng(
Default::default(),
test_runner.new_rng(),
))
.unwrap()
.current();
let reg = registry(input.clone());
Expand Down Expand Up @@ -547,18 +547,18 @@ fn meta_test_deep_trees_from_strategy() {

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

let strategy = registry_strategy(50, 20, 60);
let mut test_runner = TestRunner::deterministic();
for _ in 0..128 {
let PrettyPrintRegistry(input) = strategy
.new_tree(&mut TestRunner::default())
.new_tree(&mut TestRunner::new_with_rng(
Default::default(),
test_runner.new_rng(),
))
.unwrap()
.current();
let reg = registry(input.clone());
Expand Down

0 comments on commit 7d09f17

Please sign in to comment.