mirror of
https://github.com/rust-lang/cargo
synced 2024-09-18 07:12:12 +00:00
Proptest 0.9.1
This is a rework of #6636 now possible do to the change in testing from #6748
This commit is contained in:
parent
efd29dba7e
commit
ed9386bd24
|
@ -29,7 +29,7 @@ matrix:
|
||||||
# increased every 6 weeks or so when the first PR to use a new feature.
|
# increased every 6 weeks or so when the first PR to use a new feature.
|
||||||
- env: TARGET=x86_64-unknown-linux-gnu
|
- env: TARGET=x86_64-unknown-linux-gnu
|
||||||
ALT=i686-unknown-linux-gnu
|
ALT=i686-unknown-linux-gnu
|
||||||
rust: 1.31.0
|
rust: 1.32.0
|
||||||
script:
|
script:
|
||||||
- rustup toolchain install nightly || travis_terminate 1
|
- rustup toolchain install nightly || travis_terminate 1
|
||||||
- cargo +nightly generate-lockfile -Z minimal-versions || travis_terminate 1
|
- cargo +nightly generate-lockfile -Z minimal-versions || travis_terminate 1
|
||||||
|
|
|
@ -100,7 +100,7 @@ features = [
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
bufstream = "0.1"
|
bufstream = "0.1"
|
||||||
proptest = "0.8.7"
|
proptest = "0.9.1"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "cargo"
|
name = "cargo"
|
||||||
|
|
|
@ -8,11 +8,11 @@ use crate::support::project;
|
||||||
use crate::support::registry::Package;
|
use crate::support::registry::Package;
|
||||||
use crate::support::resolver::{
|
use crate::support::resolver::{
|
||||||
assert_contains, assert_same, dep, dep_kind, dep_loc, dep_req, dep_req_kind, loc_names, names,
|
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,
|
pkg, pkg_dep, pkg_id, pkg_loc, registry, registry_strategy, remove_dep, resolve,
|
||||||
resolve_with_config, PrettyPrintRegistry, ToDep, ToPkgId,
|
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
|
// 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,
|
// certain universal truths are upheld. Therefore, it can pass when there is a problem,
|
||||||
|
@ -107,7 +107,7 @@ proptest! {
|
||||||
#[test]
|
#[test]
|
||||||
fn removing_a_dep_cant_break(
|
fn removing_a_dep_cant_break(
|
||||||
PrettyPrintRegistry(input) in registry_strategy(50, 20, 60),
|
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 reg = registry(input.clone());
|
||||||
let mut removed_input = input.clone();
|
let mut removed_input = input.clone();
|
||||||
|
@ -149,7 +149,7 @@ proptest! {
|
||||||
#[test]
|
#[test]
|
||||||
fn limited_independence_of_irrelevant_alternatives(
|
fn limited_independence_of_irrelevant_alternatives(
|
||||||
PrettyPrintRegistry(input) in registry_strategy(50, 20, 60),
|
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());
|
let reg = registry(input.clone());
|
||||||
// there is only a small chance that any one
|
// there is only a small chance that any one
|
||||||
|
|
|
@ -508,18 +508,18 @@ pub fn registry_strategy(
|
||||||
|
|
||||||
/// This test is to test the generator to ensure
|
/// This test is to test the generator to ensure
|
||||||
/// that it makes registries with large dependency trees
|
/// 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]
|
#[test]
|
||||||
fn meta_test_deep_trees_from_strategy() {
|
fn meta_test_deep_trees_from_strategy() {
|
||||||
let mut dis = [0; 21];
|
let mut dis = [0; 21];
|
||||||
|
|
||||||
let strategy = registry_strategy(50, 20, 60);
|
let strategy = registry_strategy(50, 20, 60);
|
||||||
|
let mut test_runner = TestRunner::deterministic();
|
||||||
for _ in 0..128 {
|
for _ in 0..128 {
|
||||||
let PrettyPrintRegistry(input) = strategy
|
let PrettyPrintRegistry(input) = strategy
|
||||||
.new_tree(&mut TestRunner::default())
|
.new_tree(&mut TestRunner::new_with_rng(
|
||||||
|
Default::default(),
|
||||||
|
test_runner.new_rng(),
|
||||||
|
))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.current();
|
.current();
|
||||||
let reg = registry(input.clone());
|
let reg = registry(input.clone());
|
||||||
|
@ -547,18 +547,18 @@ fn meta_test_deep_trees_from_strategy() {
|
||||||
|
|
||||||
/// This test is to test the generator to ensure
|
/// This test is to test the generator to ensure
|
||||||
/// that it makes registries that include multiple versions of the same library
|
/// 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]
|
#[test]
|
||||||
fn meta_test_multiple_versions_strategy() {
|
fn meta_test_multiple_versions_strategy() {
|
||||||
let mut dis = [0; 10];
|
let mut dis = [0; 10];
|
||||||
|
|
||||||
let strategy = registry_strategy(50, 20, 60);
|
let strategy = registry_strategy(50, 20, 60);
|
||||||
|
let mut test_runner = TestRunner::deterministic();
|
||||||
for _ in 0..128 {
|
for _ in 0..128 {
|
||||||
let PrettyPrintRegistry(input) = strategy
|
let PrettyPrintRegistry(input) = strategy
|
||||||
.new_tree(&mut TestRunner::default())
|
.new_tree(&mut TestRunner::new_with_rng(
|
||||||
|
Default::default(),
|
||||||
|
test_runner.new_rng(),
|
||||||
|
))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.current();
|
.current();
|
||||||
let reg = registry(input.clone());
|
let reg = registry(input.clone());
|
||||||
|
|
Loading…
Reference in a new issue