summaryrefslogtreecommitdiffstats
path: root/tests/run-make/rustdoc-scrape-examples-multiple
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
commita4b7ed7a42c716ab9f05e351f003d589124fd55d (patch)
treeb620cd3f223850b28716e474e80c58059dca5dd4 /tests/run-make/rustdoc-scrape-examples-multiple
parentAdding upstream version 1.67.1+dfsg1. (diff)
downloadrustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.tar.xz
rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.zip
Adding upstream version 1.68.2+dfsg1.upstream/1.68.2+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/run-make/rustdoc-scrape-examples-multiple')
-rw-r--r--tests/run-make/rustdoc-scrape-examples-multiple/Makefile5
-rw-r--r--tests/run-make/rustdoc-scrape-examples-multiple/examples/ex.rs4
-rw-r--r--tests/run-make/rustdoc-scrape-examples-multiple/examples/ex2.rs3
-rw-r--r--tests/run-make/rustdoc-scrape-examples-multiple/scrape.mk21
-rw-r--r--tests/run-make/rustdoc-scrape-examples-multiple/src/lib.rs6
5 files changed, 39 insertions, 0 deletions
diff --git a/tests/run-make/rustdoc-scrape-examples-multiple/Makefile b/tests/run-make/rustdoc-scrape-examples-multiple/Makefile
new file mode 100644
index 000000000..453a7d4bc
--- /dev/null
+++ b/tests/run-make/rustdoc-scrape-examples-multiple/Makefile
@@ -0,0 +1,5 @@
+deps := ex ex2
+
+include ./scrape.mk
+
+all: scrape
diff --git a/tests/run-make/rustdoc-scrape-examples-multiple/examples/ex.rs b/tests/run-make/rustdoc-scrape-examples-multiple/examples/ex.rs
new file mode 100644
index 000000000..01b730c61
--- /dev/null
+++ b/tests/run-make/rustdoc-scrape-examples-multiple/examples/ex.rs
@@ -0,0 +1,4 @@
+fn main() {
+ foobar::ok();
+ foobar::ok();
+}
diff --git a/tests/run-make/rustdoc-scrape-examples-multiple/examples/ex2.rs b/tests/run-make/rustdoc-scrape-examples-multiple/examples/ex2.rs
new file mode 100644
index 000000000..f83cf2f27
--- /dev/null
+++ b/tests/run-make/rustdoc-scrape-examples-multiple/examples/ex2.rs
@@ -0,0 +1,3 @@
+fn main() {
+ foobar::ok();
+}
diff --git a/tests/run-make/rustdoc-scrape-examples-multiple/scrape.mk b/tests/run-make/rustdoc-scrape-examples-multiple/scrape.mk
new file mode 100644
index 000000000..7a28d2145
--- /dev/null
+++ b/tests/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/tests/run-make/rustdoc-scrape-examples-multiple/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-multiple/src/lib.rs
new file mode 100644
index 000000000..bdfeda92d
--- /dev/null
+++ b/tests/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() {}