yanais/crates/yn-qgy4hbz-core/tests/exs.rs

24 lines
590 B
Rust
Raw Normal View History

2023-09-24 21:58:28 +00:00
use readfilez::read_from_file;
2023-09-25 12:33:56 +00:00
use yn_qgy4hbz_core::parser::{Env as ParseEnv, Lexer, Parse};
2023-09-24 21:58:28 +00:00
fn do_parse(f: &str) {
let fh = read_from_file(std::fs::File::open(f)).expect("unable to open example file");
2023-09-25 12:33:56 +00:00
let mut penv = ParseEnv::new(Lexer::new(
core::str::from_utf8(&*fh).expect("unable to parse example file (UTF-8)"),
));
2023-09-25 13:08:48 +00:00
println!(
"{:#?}",
yn_qgy4hbz_core::Expr::parse(&mut penv).expect("unable to parse example file (yanais)")
);
2023-09-24 21:58:28 +00:00
}
#[test]
2023-09-25 12:33:56 +00:00
fn ex00() {
do_parse("tests/ex00.yns");
}
2023-09-25 13:08:48 +00:00
#[test]
fn ex01() {
do_parse("tests/ex01.yns");
}