summaryrefslogtreecommitdiffstats
path: root/src/test/run-make/rustdoc-scrape-examples-multiple
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/run-make/rustdoc-scrape-examples-multiple
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/run-make/rustdoc-scrape-examples-multiple')
-rw-r--r--src/test/run-make/rustdoc-scrape-examples-multiple/Makefile5
-rw-r--r--src/test/run-make/rustdoc-scrape-examples-multiple/examples/ex.rs4
-rw-r--r--src/test/run-make/rustdoc-scrape-examples-multiple/examples/ex2.rs3
-rw-r--r--src/test/run-make/rustdoc-scrape-examples-multiple/scrape.mk21
-rw-r--r--src/test/run-make/rustdoc-scrape-examples-multiple/src/lib.rs6
5 files changed, 39 insertions, 0 deletions
diff --git a/src/test/run-make/rustdoc-scrape-examples-multiple/Makefile b/src/test/run-make/rustdoc-scrape-examples-multiple/Makefile
new file mode 100644
index 000000000..897805e44
--- /dev/null
+++ b/src/test/run-make/rustdoc-scrape-examples-multiple/Makefile
@@ -0,0 +1,5 @@
+deps := ex ex2
+
+-include ./scrape.mk
+
+all: scrape
diff --git a/src/test/run-make/rustdoc-scrape-examples-multiple/examples/ex.rs b/src/test/run-make/rustdoc-scrape-examples-multiple/examples/ex.rs
new file mode 100644
index 000000000..01b730c61
--- /dev/null
+++ b/src/test/run-make/rustdoc-scrape-examples-multiple/examples/ex.rs
@@ -0,0 +1,4 @@
+fn main() {
+ foobar::ok();
+ foobar::ok();
+}
diff --git a/src/test/run-make/rustdoc-scrape-examples-multiple/examples/ex2.rs b/src/test/run-make/rustdoc-scrape-examples-multiple/examples/ex2.rs
new file mode 100644
index 000000000..f83cf2f27
--- /dev/null
+++ b/src/test/run-make/rustdoc-scrape-examples-multiple/examples/ex2.rs
@@ -0,0 +1,3 @@
+fn main() {
+ foobar::ok();
+}
diff --git a/src/test/run-make/rustdoc-scrape-examples-multiple/scrape.mk b/src/test/run-make/rustdoc-scrape-examples-multiple/scrape.mk
new file mode 100644
index 000000000..d49b6c1f2
--- /dev/null
+++ b/src/test/run-make/rustdoc-scrape-examples-multiple/scrape.mk
@@ -0,0 +1,21 @@
+-include ../../run-make-fulldeps/tools.mk
+
+OUTPUT_DIR := "$(TMPDIR)/rustdoc"
+
+$(TMPDIR)/%.calls: $(TMPDIR)/libfoobar.rmeta
+ $(RUSTDOC) examples/$*.rs --crate-name $* --crate-type bin --output $(OUTPUT_DIR) \
+ --extern foobar=$(TMPDIR)/libfoobar.rmeta \
+ -Z unstable-options \
+ --scrape-examples-output-path $@ \
+ --scrape-examples-target-crate foobar \
+ $(extra_flags)
+
+$(TMPDIR)/lib%.rmeta: src/lib.rs
+ $(RUSTC) src/lib.rs --crate-name $* --crate-type lib --emit=metadata
+
+scrape: $(foreach d,$(deps),$(TMPDIR)/$(d).calls)
+ $(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --output $(OUTPUT_DIR) \
+ -Z unstable-options \
+ $(foreach d,$(deps),--with-examples $(TMPDIR)/$(d).calls)
+
+ $(HTMLDOCCK) $(OUTPUT_DIR) src/lib.rs
diff --git a/src/test/run-make/rustdoc-scrape-examples-multiple/src/lib.rs b/src/test/run-make/rustdoc-scrape-examples-multiple/src/lib.rs
new file mode 100644
index 000000000..bdfeda92d
--- /dev/null
+++ b/src/test/run-make/rustdoc-scrape-examples-multiple/src/lib.rs
@@ -0,0 +1,6 @@
+// @has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]//*[@class="prev"]' ''
+// @has foobar/fn.ok.html '//*[@class="more-scraped-examples"]' ''
+// @has src/ex/ex.rs.html
+// @has foobar/fn.ok.html '//a[@href="../src/ex/ex.rs.html#2"]' ''
+
+pub fn ok() {}