Skip to content

Commit

Permalink
Update golden tests file
Browse files Browse the repository at this point in the history
  • Loading branch information
imaqtkatt committed Feb 29, 2024
1 parent 0185d8f commit 98bf2f7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ pub fn run_book(
run_opts: RunOpts,
warning_opts: WarningOpts,
compile_opts: CompileOpts,
args: Vec<Term>,
args: Option<Vec<Term>>,
) -> Result<(Term, RunInfo), Info> {
let CompileResult { core_book, labels, warns } = compile_book(&mut book, Some(args), compile_opts)?;
let CompileResult { core_book, labels, warns } = compile_book(&mut book, args, compile_opts)?;

// Turn the book into an Arc so that we can use it for logging, debugging, etc.
// from anywhere else in the program
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ enum Mode {
chumsky::error::RichReason::Many(errs) => format!("{}", &errs[0]),
_ => format!("{}", e[0].reason()),
}))]
arguments: Vec<hvml::term::Term>,
arguments: Option<Vec<hvml::term::Term>>,

#[command(flatten)]
warn_opts: CliWarnOpts,
Expand Down
16 changes: 9 additions & 7 deletions tests/golden_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ fn linear_readback() {
RunOpts { linear: true, ..Default::default() },
WarningOpts::deny_all(),
CompileOpts::heavy(),
None,
)?;
Ok(format!("{}{}", display_readback_errors(&info.readback_errors), res))
});
Expand All @@ -143,14 +144,14 @@ fn run_file() {
let book = do_parse_book(code, path)?;
// 1 million nodes for the test runtime. Smaller doesn't seem to make it any faster
let (res, info) =
run_book(book, 1 << 24, RunOpts::lazy(), WarningOpts::deny_all(), CompileOpts::heavy())?;
run_book(book, 1 << 24, RunOpts::lazy(), WarningOpts::deny_all(), CompileOpts::heavy(), None)?;
Ok(format!("{}{}", display_readback_errors(&info.readback_errors), res))
}),
(&|code, path| {
let book = do_parse_book(code, path)?;
// 1 million nodes for the test runtime. Smaller doesn't seem to make it any faster
let (res, info) =
run_book(book, 1 << 24, RunOpts::default(), WarningOpts::deny_all(), CompileOpts::heavy())?;
run_book(book, 1 << 24, RunOpts::default(), WarningOpts::deny_all(), CompileOpts::heavy(), None)?;
Ok(format!("{}{}", display_readback_errors(&info.readback_errors), res))
}),
])
Expand All @@ -166,7 +167,7 @@ fn run_lazy() {
desugar_opts.lazy_mode();

// 1 million nodes for the test runtime. Smaller doesn't seem to make it any faster
let (res, info) = run_book(book, 1 << 24, run_opts, WarningOpts::deny_all(), desugar_opts)?;
let (res, info) = run_book(book, 1 << 24, run_opts, WarningOpts::deny_all(), desugar_opts, None)?;
Ok(format!("{}{}", display_readback_errors(&info.readback_errors), res))
})
}
Expand All @@ -188,7 +189,7 @@ fn simplify_matches() {
let mut book = do_parse_book(code, path)?;
let mut ctx = Ctx::new(&mut book);
ctx.check_shared_names();
ctx.set_entrypoint();
ctx.set_entrypoint(0);
ctx.book.encode_adts(AdtEncoding::TaggedScott);
ctx.book.encode_builtins();
ctx.book.resolve_ctrs_in_pats();
Expand Down Expand Up @@ -226,7 +227,7 @@ fn encode_pattern_match() {
let mut book = do_parse_book(code, path)?;
let mut ctx = Ctx::new(&mut book);
ctx.check_shared_names();
ctx.set_entrypoint();
ctx.set_entrypoint(0);
ctx.book.encode_adts(adt_encoding);
ctx.book.encode_builtins();
ctx.book.resolve_ctrs_in_pats();
Expand Down Expand Up @@ -273,7 +274,8 @@ fn hangs() {
let lck = Arc::new(RwLock::new(false));
let got = lck.clone();
std::thread::spawn(move || {
let _ = run_book(book, 1 << 20, RunOpts::default(), WarningOpts::deny_all(), CompileOpts::heavy());
let _ =
run_book(book, 1 << 20, RunOpts::default(), WarningOpts::deny_all(), CompileOpts::heavy(), None);
*got.write().unwrap() = true;
});
std::thread::sleep(std::time::Duration::from_secs(expected_normalization_time));
Expand All @@ -299,7 +301,7 @@ fn run_entrypoint() {
book.entrypoint = Some(Name::from("foo"));
// 1 million nodes for the test runtime. Smaller doesn't seem to make it any faster
let (res, info) =
run_book(book, 1 << 24, RunOpts::default(), WarningOpts::deny_all(), CompileOpts::heavy())?;
run_book(book, 1 << 24, RunOpts::default(), WarningOpts::deny_all(), CompileOpts::heavy(), None)?;
Ok(format!("{}{}", display_readback_errors(&info.readback_errors), res))
})
}

0 comments on commit 98bf2f7

Please sign in to comment.