about summary refs log tree commit diff
path: root/tests/run-make/rustdoc-scrape-examples-multiple
diff options
context:
space:
mode:
authorAlbert Larsan <74931857+albertlarsan68@users.noreply.github.com>2023-01-05 09:13:28 +0100
committerAlbert Larsan <74931857+albertlarsan68@users.noreply.github.com>2023-01-11 09:32:08 +0000
commitcf2dff2b1e3fa55fa5415d524200070d0d7aacfe (patch)
tree40a88d9a46aaf3e8870676eb2538378b75a263eb /tests/run-make/rustdoc-scrape-examples-multiple
parentca855e6e42787ecd062d81d53336fe6788ef51a9 (diff)
downloadrust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.tar.gz
rust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.zip
Move /src/test to /tests
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 00000000000..453a7d4bc8b
--- /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 00000000000..01b730c6149
--- /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 00000000000..f83cf2f2709
--- /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 00000000000..7a28d2145d5
--- /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 00000000000..bdfeda92d79
--- /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() {}