Skip to content

Commit 834347d

Browse files
Add rustdoc JS non-std tests
1 parent da57320 commit 834347d

File tree

6 files changed

+420
-1
lines changed

6 files changed

+420
-1
lines changed

src/bootstrap/builder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ impl<'a> Builder<'a> {
406406
test::Clippy,
407407
test::CompiletestTest,
408408
test::RustdocJS,
409+
test::RustdocJSNotStd,
409410
test::RustdocTheme,
410411
// Run bootstrap close to the end as it's unlikely to fail
411412
test::Bootstrap,

src/bootstrap/test.rs

+44
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,50 @@ impl Step for RustdocJS {
612612
}
613613
}
614614

615+
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
616+
pub struct RustdocJSNotStd {
617+
pub host: Interned<String>,
618+
pub target: Interned<String>,
619+
pub compiler: Compiler,
620+
}
621+
622+
impl Step for RustdocJSNotStd {
623+
type Output = ();
624+
const DEFAULT: bool = true;
625+
const ONLY_HOSTS: bool = true;
626+
627+
fn should_run(run: ShouldRun) -> ShouldRun {
628+
run.path("src/test/rustdoc-js-not-std")
629+
}
630+
631+
fn make_run(run: RunConfig) {
632+
let compiler = run.builder.compiler(run.builder.top_stage, run.host);
633+
run.builder.ensure(RustdocJSNotStd {
634+
host: run.host,
635+
target: run.target,
636+
compiler,
637+
});
638+
}
639+
640+
fn run(self, builder: &Builder) {
641+
if let Some(ref nodejs) = builder.config.nodejs {
642+
let mut command = Command::new(nodejs);
643+
command.args(&["src/tools/rustdoc-js-not-std/tester.js",
644+
&*self.host,
645+
builder.top_stage.to_string().as_str()]);
646+
builder.ensure(crate::doc::Std {
647+
target: self.target,
648+
stage: builder.top_stage,
649+
});
650+
builder.run(&mut command);
651+
} else {
652+
builder.info(
653+
"No nodejs found, skipping \"src/test/rustdoc-js-not-std\" tests"
654+
);
655+
}
656+
}
657+
}
658+
615659
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
616660
pub struct RustdocUi {
617661
pub host: Interned<String>,

src/test/rustdoc-js-not-std/basic.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const QUERY = 'Fo';
2+
3+
const EXPECTED = {
4+
'others': [
5+
{ 'path': 'basic', 'name': 'Foo' },
6+
],
7+
};

src/test/rustdoc-js-not-std/basic.rs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub struct Foo;

0 commit comments

Comments
 (0)