mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 23:37:48 +02:00
Add quickcheck (#1574)
* Move uptime to being a duration value * Adds our first quickcheck test
This commit is contained in:
@ -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]
|
||||
mod prelude;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate quickcheck;
|
||||
#[cfg(test)]
|
||||
#[macro_use(quickcheck)]
|
||||
extern crate quickcheck_macros;
|
||||
|
||||
mod cli;
|
||||
mod commands;
|
||||
mod context;
|
||||
|
Reference in New Issue
Block a user