about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-12-18 15:16:39 -0800
committerbors <bors@rust-lang.org>2013-12-18 15:16:39 -0800
commitb6933f8d8b86f78ac7b5f70f0781d794144763a0 (patch)
tree0b728b4841aefa0191dfabb7e69e2e94649d8f18 /src
parentc87b9d37f7a72e8632af676c2bb579f8967d9cd8 (diff)
parent21bec4f11bd66f9ff7e74eb878efe3d487057329 (diff)
downloadrust-b6933f8d8b86f78ac7b5f70f0781d794144763a0.tar.gz
rust-b6933f8d8b86f78ac7b5f70f0781d794144763a0.zip
auto merge of #11032 : cmr/rust/rustdoc_test, r=alexcrichton
This is just a smoke test which verifies that the expected files are
generated.
Diffstat (limited to 'src')
-rw-r--r--src/etc/maketest.py1
-rw-r--r--src/librustdoc/html/render.rs12
-rw-r--r--src/test/run-make/rustdoc-smoke/Makefile5
-rw-r--r--src/test/run-make/rustdoc-smoke/foo.rs15
-rwxr-xr-xsrc/test/run-make/rustdoc-smoke/verify.sh17
5 files changed, 47 insertions, 3 deletions
diff --git a/src/etc/maketest.py b/src/etc/maketest.py
index 96c658e5686..00d80e1bf4d 100644
--- a/src/etc/maketest.py
+++ b/src/etc/maketest.py
@@ -7,6 +7,7 @@ import sys
 os.putenv('RUSTC', os.path.abspath(sys.argv[2]))
 os.putenv('TMPDIR', os.path.abspath(sys.argv[3]))
 os.putenv('CC', sys.argv[4])
+os.putenv('RUSTDOC', os.path.abspath(sys.argv[5]))
 
 proc = subprocess.Popen(['make', '-C', sys.argv[1]],
                         stdout = subprocess.PIPE,
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 3d2e03785ed..c84caf8acdd 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -678,7 +678,13 @@ impl Context {
         // using a rwarc makes this parallelizable in the future
         local_data::set(cache_key, Arc::new(cache));
 
-        self.item(item);
+        let mut work = ~[(self, item)];
+        while work.len() > 0 {
+            let (mut cx, item) = work.pop();
+            cx.item(item, |cx, item| {
+                work.push((cx.clone(), item));
+            })
+        }
     }
 
     /// Non-parellelized version of rendering an item. This will take the input
@@ -686,7 +692,7 @@ impl Context {
     /// all sub-items which need to be rendered.
     ///
     /// The rendering driver uses this closure to queue up more work.
-    fn item(&mut self, item: clean::Item) {
+    fn item(&mut self, item: clean::Item, f: |&mut Context, clean::Item|) {
         fn render(w: io::File, cx: &mut Context, it: &clean::Item,
                   pushname: bool) {
             info!("Rendering an item to {}", w.path().display());
@@ -733,7 +739,7 @@ impl Context {
                     };
                     this.sidebar = build_sidebar(&m);
                     for item in m.items.move_iter() {
-                        this.item(item);
+                        f(this,item);
                     }
                 })
             }
diff --git a/src/test/run-make/rustdoc-smoke/Makefile b/src/test/run-make/rustdoc-smoke/Makefile
new file mode 100644
index 00000000000..0de678e7248
--- /dev/null
+++ b/src/test/run-make/rustdoc-smoke/Makefile
@@ -0,0 +1,5 @@
+-include ../tools.mk
+all:
+	$(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
+	cp verify.sh $(TMPDIR)
+	$(call RUN,verify.sh) $(TMPDIR)
diff --git a/src/test/run-make/rustdoc-smoke/foo.rs b/src/test/run-make/rustdoc-smoke/foo.rs
new file mode 100644
index 00000000000..7a86bf4d1e8
--- /dev/null
+++ b/src/test/run-make/rustdoc-smoke/foo.rs
@@ -0,0 +1,15 @@
+#[pkgid = "foo#0.1"];
+
+//! Very docs
+
+pub mod bar {
+
+    /// So correct
+    pub mod baz {
+        /// Much detail
+        pub fn baz() { }
+    }
+
+    /// *wow*
+    pub trait Doge { }
+}
diff --git a/src/test/run-make/rustdoc-smoke/verify.sh b/src/test/run-make/rustdoc-smoke/verify.sh
new file mode 100755
index 00000000000..18f3939794e
--- /dev/null
+++ b/src/test/run-make/rustdoc-smoke/verify.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# $1 is the TMPDIR
+
+dirs="doc doc/foo doc/foo/bar doc/foo/bar/baz doc/src doc/src/foo"
+
+for dir in $dirs; do if [ ! -d $1/$dir ]; then
+	echo "$1/$dir is not a directory!"
+	exit 1
+fi done
+
+files="doc/foo/index.html doc/foo/bar/index.html doc/foo/bar/baz/fn.baz.html doc/foo/bar/trait.Doge.html doc/src/foo/foo.rs.html"
+
+for file in $files; do if [ ! -f $1/$file ]; then
+	echo "$1/$file is not a file!"
+	exit 1
+fi done