Hook the integration tests into rust's test framework.

Instead of using a hacked-together shell script, use rust's test framework to do the comparison.
This commit is contained in:
Tom Alexander
2023-04-18 22:38:18 -04:00
parent fba80f4f7b
commit 72c8da94a3
6 changed files with 96 additions and 1 deletions

17
tests/test_template Normal file
View File

@@ -0,0 +1,17 @@
#[test]
fn {name}() {{
let todo_org_path = "{path}";
let org_contents = std::fs::read_to_string(todo_org_path).expect("Read org file.");
let org_sexp = emacs_parse_org_document(todo_org_path).expect("Use emacs to parse org file.");
println!("{{}}", org_sexp);
let (_remaining, parsed_sexp) = sexp(org_sexp.as_str()).expect("Sexp Parse failure");
let (remaining, rust_parsed) = document(org_contents.as_str()).expect("Org Parse failure");
println!("{{:#?}}", rust_parsed);
let diff_result =
compare_document(&parsed_sexp, &rust_parsed).expect("Compare parsed documents.");
diff_result
.print()
.expect("Print document parse tree diff.");
assert!(!diff_result.is_bad());
assert_eq!(remaining, "");
}}