Skip to content

Commit 0a6a74b

Browse files
Reduce merged doctest source code size
1 parent a83dde6 commit 0a6a74b

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

Diff for: test/src/types.rs

+34
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,37 @@ pub struct TestDescAndFn {
250250
pub desc: TestDesc,
251251
pub testfn: TestFn,
252252
}
253+
254+
impl TestDescAndFn {
255+
pub const fn new_doctest(
256+
test_name: &'static str,
257+
ignore: bool,
258+
source_file: &'static str,
259+
start_line: usize,
260+
no_run: bool,
261+
should_panic: bool,
262+
testfn: TestFn,
263+
) -> Self {
264+
Self {
265+
desc: TestDesc {
266+
name: StaticTestName(test_name),
267+
ignore,
268+
ignore_message: None,
269+
source_file,
270+
start_line,
271+
start_col: 0,
272+
end_line: 0,
273+
end_col: 0,
274+
compile_fail: false,
275+
no_run,
276+
should_panic: if should_panic {
277+
options::ShouldPanic::Yes
278+
} else {
279+
options::ShouldPanic::No
280+
},
281+
test_type: TestType::DocTest,
282+
},
283+
testfn,
284+
}
285+
}
286+
}

0 commit comments

Comments
 (0)