Skip to content

Commit

Permalink
Reduce merged doctest source code size
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Aug 13, 2024
1 parent a83dde6 commit 0a6a74b
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,37 @@ pub struct TestDescAndFn {
pub desc: TestDesc,
pub testfn: TestFn,
}

impl TestDescAndFn {
pub const fn new_doctest(
test_name: &'static str,
ignore: bool,
source_file: &'static str,
start_line: usize,
no_run: bool,
should_panic: bool,
testfn: TestFn,
) -> Self {
Self {
desc: TestDesc {
name: StaticTestName(test_name),
ignore,
ignore_message: None,
source_file,
start_line,
start_col: 0,
end_line: 0,
end_col: 0,
compile_fail: false,
no_run,
should_panic: if should_panic {
options::ShouldPanic::Yes
} else {
options::ShouldPanic::No
},
test_type: TestType::DocTest,
},
testfn,
}
}
}

0 comments on commit 0a6a74b

Please sign in to comment.