2022-02-04 02:01:45 +00:00
|
|
|
use nu_command::create_default_context;
|
|
|
|
use nu_protocol::engine::StateWorkingSet;
|
2021-06-30 22:47:56 +00:00
|
|
|
use quickcheck_macros::quickcheck;
|
2020-03-04 18:58:20 +00:00
|
|
|
|
|
|
|
mod commands;
|
|
|
|
mod format_conversions;
|
2021-06-30 22:47:56 +00:00
|
|
|
|
2022-02-04 02:01:45 +00:00
|
|
|
// use nu_engine::EvaluationContext;
|
|
|
|
|
|
|
|
#[quickcheck]
|
|
|
|
fn quickcheck_parse(data: String) -> bool {
|
|
|
|
let (tokens, err) = nu_parser::lex(data.as_bytes(), 0, b"", b"", true);
|
|
|
|
let (lite_block, err2) = nu_parser::lite_parse(&tokens);
|
|
|
|
|
|
|
|
if err.is_none() && err2.is_none() {
|
2022-07-14 14:09:27 +00:00
|
|
|
let context = create_default_context();
|
2022-02-04 02:01:45 +00:00
|
|
|
{
|
|
|
|
let mut working_set = StateWorkingSet::new(&context);
|
|
|
|
working_set.add_file("quickcheck".into(), data.as_bytes());
|
|
|
|
|
2022-04-08 21:41:05 +00:00
|
|
|
let _ = nu_parser::parse_block(&mut working_set, &lite_block, false, &[], false);
|
2022-02-04 02:01:45 +00:00
|
|
|
}
|
2021-06-30 22:47:56 +00:00
|
|
|
}
|
|
|
|
true
|
|
|
|
}
|