Skip to content

Commit

Permalink
test: fix tests broken by SnapTestRunner api change
Browse files Browse the repository at this point in the history
  • Loading branch information
nfejzic committed Oct 13, 2024
1 parent d722faf commit c202884
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
27 changes: 13 additions & 14 deletions core/tests/runner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,19 @@ fn run_spec_test(case: test_runner::test_file::TestCase) {
}

fn run_snap_test(case: test_runner::test_file::TestCase) {
let tokens = unimarkup_commons::lexer::token::lex_str(&case.test.input);

let mut snap_runner = SnapTestRunner::with_fn::<_, _>(&case.test.name, &tokens, |_input| {
let um = unimarkup_core::parser::parse_unimarkup(
&case.test.input,
unimarkup_commons::config::Config::default(),
);

Snapshot(um.blocks).as_snapshot()
})
.with_info(format!(
"Test '{}' from: {}",
case.test.name, case.file_path
));
let mut snap_runner =
SnapTestRunner::with_fn::<_, _>(&case.test.name, &case.test.input, |_input| {
let um = unimarkup_core::parser::parse_unimarkup(
&case.test.input,
unimarkup_commons::config::Config::default(),
);

Snapshot(um.blocks).as_snapshot()
})
.with_info(format!(
"Test '{}' from: {}",
case.test.name, case.file_path
));

if let Some(ref description) = case.test.description {
snap_runner = snap_runner.with_description(description);
Expand Down
7 changes: 4 additions & 3 deletions inline/tests/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ fn run_spec_test(case: test_runner::test_file::TestCase) {
}

fn run_snap_test(case: test_runner::test_file::TestCase) {
let tokens = unimarkup_commons::lexer::token::lex_str(&case.test.input);
let runner = SnapTestRunner::with_fn(&case.test.name, &case.test.input, |input| {
let slice: &[_] = &unimarkup_commons::lexer::token::lex_str(input);
let token_iterator = slice.into();

let runner = SnapTestRunner::with_fn(&case.test.name, &tokens, |slice| {
let (_, _, parsed_inlines) = unimarkup_inline::parser::parse_inlines(
slice.into(),
token_iterator,
InlineContext::default(),
None,
None,
Expand Down

0 comments on commit c202884

Please sign in to comment.