Fix weird memory allocation failure in merged doctests by storing doctest list into a const
This commit is contained in:
parent
b6831bbdda
commit
dcc77b4cbc
1 changed files with 8 additions and 8 deletions
|
@ -45,11 +45,11 @@ impl DocTestRunner {
|
||||||
self.crate_attrs.insert(line.to_string());
|
self.crate_attrs.insert(line.to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if !self.ids.is_empty() {
|
if !self.ids.is_empty() {
|
||||||
// self.ids.push(',');
|
self.ids.push(',');
|
||||||
// }
|
}
|
||||||
self.ids.push_str(&format!(
|
self.ids.push_str(&format!(
|
||||||
"tests.push({}::TEST);\n",
|
"{}::TEST",
|
||||||
generate_mergeable_doctest(
|
generate_mergeable_doctest(
|
||||||
doctest,
|
doctest,
|
||||||
scraped_test,
|
scraped_test,
|
||||||
|
@ -107,14 +107,14 @@ impl DocTestRunner {
|
||||||
#[rustc_main]
|
#[rustc_main]
|
||||||
#[coverage(off)]
|
#[coverage(off)]
|
||||||
fn main() {{
|
fn main() {{
|
||||||
let mut tests = Vec::new();
|
const TESTS: [test::TestDescAndFn; {nb_tests}] = [{ids}];
|
||||||
{ids}
|
|
||||||
test::test_main(
|
test::test_main(
|
||||||
&[{test_args}],
|
&[{test_args}],
|
||||||
tests,
|
Vec::from(TESTS),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
}}",
|
}}",
|
||||||
|
nb_tests = self.nb_tests,
|
||||||
output = self.output,
|
output = self.output,
|
||||||
ids = self.ids,
|
ids = self.ids,
|
||||||
)
|
)
|
||||||
|
@ -192,7 +192,7 @@ pub const TEST: test::TestDescAndFn = test::TestDescAndFn {{
|
||||||
compile_fail: false,
|
compile_fail: false,
|
||||||
no_run: {no_run},
|
no_run: {no_run},
|
||||||
should_panic: test::ShouldPanic::{should_panic},
|
should_panic: test::ShouldPanic::{should_panic},
|
||||||
test_type: test::TestType::UnitTest,
|
test_type: test::TestType::DocTest,
|
||||||
}},
|
}},
|
||||||
testfn: test::StaticTestFn(
|
testfn: test::StaticTestFn(
|
||||||
#[coverage(off)]
|
#[coverage(off)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue