Add quickcheck (#1574)

* Move uptime to being a duration value

* Adds our first quickcheck test
This commit is contained in:
Jonathan Turner
2020-04-12 07:05:59 +12:00
committed by GitHub
parent 18dd009ca8
commit dd4935fb23
4 changed files with 51 additions and 0 deletions

View File

@ -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
}
}
}

View File

@ -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;