mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 08:23:24 +01:00
Add quickcheck (#1574)
* Move uptime to being a duration value * Adds our first quickcheck test
This commit is contained in:
parent
18dd009ca8
commit
dd4935fb23
25
Cargo.lock
generated
25
Cargo.lock
generated
@ -2098,6 +2098,8 @@ dependencies = [
|
|||||||
"prettytable-rs",
|
"prettytable-rs",
|
||||||
"ptree",
|
"ptree",
|
||||||
"query_interface",
|
"query_interface",
|
||||||
|
"quickcheck",
|
||||||
|
"quickcheck_macros",
|
||||||
"rand",
|
"rand",
|
||||||
"regex",
|
"regex",
|
||||||
"roxmltree",
|
"roxmltree",
|
||||||
@ -2848,6 +2850,29 @@ dependencies = [
|
|||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quickcheck"
|
||||||
|
version = "0.9.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f"
|
||||||
|
dependencies = [
|
||||||
|
"env_logger",
|
||||||
|
"log",
|
||||||
|
"rand",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quickcheck_macros"
|
||||||
|
version = "0.9.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "608c156fd8e97febc07dc9c2e2c80bf74cfc6ef26893eae3daf8bc2bc94a4b7f"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.2"
|
version = "1.0.2"
|
||||||
|
@ -97,6 +97,10 @@ features = ["bundled", "blob"]
|
|||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
nu-build = { version = "0.12.0", path = "../nu-build" }
|
nu-build = { version = "0.12.0", path = "../nu-build" }
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
quickcheck = "0.9"
|
||||||
|
quickcheck_macros = "0.9"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
stable = []
|
stable = []
|
||||||
starship-prompt = ["starship"]
|
starship-prompt = ["starship"]
|
||||||
|
@ -776,3 +776,19 @@ pub fn print_err(err: ShellError, host: &dyn Host, source: &Text) {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
|
||||||
|
#[quickcheck]
|
||||||
|
fn quickcheck_parse(data: String) -> bool {
|
||||||
|
if let Ok(lite_pipeline) = nu_parser::lite_parse(&data, 0) {
|
||||||
|
let context = crate::context::Context::basic().unwrap();
|
||||||
|
nu_parser::classify_pipeline(&lite_pipeline, context.registry())
|
||||||
|
.failed
|
||||||
|
.is_none()
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -7,6 +7,12 @@ extern crate indexmap;
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod prelude;
|
mod prelude;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
extern crate quickcheck;
|
||||||
|
#[cfg(test)]
|
||||||
|
#[macro_use(quickcheck)]
|
||||||
|
extern crate quickcheck_macros;
|
||||||
|
|
||||||
mod cli;
|
mod cli;
|
||||||
mod commands;
|
mod commands;
|
||||||
mod context;
|
mod context;
|
||||||
|
Loading…
Reference in New Issue
Block a user