about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorCamelid <camelidcamel@gmail.com>2020-12-25 15:38:46 -0800
committerCamelid <camelidcamel@gmail.com>2020-12-25 15:53:17 -0800
commit50c1c27fa6adbb20ce61fce7caaea489e3984265 (patch)
tree679be67028ef9d3c931006a2fd3ebce8704ab7e4 /src/test/rustdoc
parentd3f4c48b49929b9d5de7d65c608a244a1b5f9e81 (diff)
downloadrust-50c1c27fa6adbb20ce61fce7caaea489e3984265.tar.gz
rust-50c1c27fa6adbb20ce61fce7caaea489e3984265.zip
Fix bugs; fix and add tests
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/decl_macro_priv.rs2
-rw-r--r--src/test/rustdoc/pub-restricted.rs32
-rw-r--r--src/test/rustdoc/visibility.rs13
3 files changed, 30 insertions, 17 deletions
diff --git a/src/test/rustdoc/decl_macro_priv.rs b/src/test/rustdoc/decl_macro_priv.rs
index 4e1279e34d9..cb71bca9cf2 100644
--- a/src/test/rustdoc/decl_macro_priv.rs
+++ b/src/test/rustdoc/decl_macro_priv.rs
@@ -2,7 +2,7 @@
 
 #![feature(decl_macro)]
 
-// @has decl_macro_priv/macro.crate_macro.html //pre 'pub(crate) macro crate_macro() {'
+// @has decl_macro_priv/macro.crate_macro.html //pre 'macro crate_macro() {'
 // @has - //pre '...'
 // @has - //pre '}'
 pub(crate) macro crate_macro() {}
diff --git a/src/test/rustdoc/pub-restricted.rs b/src/test/rustdoc/pub-restricted.rs
index 6720d848ac3..9ff3cad070d 100644
--- a/src/test/rustdoc/pub-restricted.rs
+++ b/src/test/rustdoc/pub-restricted.rs
@@ -6,27 +6,27 @@
 
 // @has 'foo/struct.FooPublic.html' '//pre' 'pub struct FooPublic'
 pub struct FooPublic;
-// @has 'foo/struct.FooJustCrate.html' '//pre' 'pub(crate) struct FooJustCrate'
+// @has 'foo/struct.FooJustCrate.html' '//pre' 'struct FooJustCrate'
 crate struct FooJustCrate;
-// @has 'foo/struct.FooPubCrate.html' '//pre' 'pub(crate) struct FooPubCrate'
+// @has 'foo/struct.FooPubCrate.html' '//pre' 'struct FooPubCrate'
 pub(crate) struct FooPubCrate;
-// @has 'foo/struct.FooSelf.html' '//pre' 'pub(crate) struct FooSelf'
+// @has 'foo/struct.FooSelf.html' '//pre' 'struct FooSelf'
 pub(self) struct FooSelf;
-// @has 'foo/struct.FooInSelf.html' '//pre' 'pub(crate) struct FooInSelf'
+// @has 'foo/struct.FooInSelf.html' '//pre' 'struct FooInSelf'
 pub(in self) struct FooInSelf;
 mod a {
-    // @has 'foo/a/struct.FooSuper.html' '//pre' 'pub(crate) struct FooSuper'
-    pub(super) struct FooSuper;
-    // @has 'foo/a/struct.FooInSuper.html' '//pre' 'pub(crate) struct FooInSuper'
-    pub(in super) struct FooInSuper;
-    // @has 'foo/a/struct.FooInA.html' '//pre' 'pub(in a) struct FooInA'
-    pub(in a) struct FooInA;
+    // @has 'foo/a/struct.FooASuper.html' '//pre' 'pub(crate) struct FooASuper'
+    pub(super) struct FooASuper;
+    // @has 'foo/a/struct.FooAInSuper.html' '//pre' 'pub(crate) struct FooAInSuper'
+    pub(in super) struct FooAInSuper;
+    // @has 'foo/a/struct.FooAInA.html' '//pre' 'struct FooAInA'
+    pub(in a) struct FooAInA;
     mod b {
-        // @has 'foo/a/b/struct.FooInSelfSuperB.html' '//pre' 'pub(in a::b) struct FooInSelfSuperB'
-        pub(in a::b) struct FooInSelfSuperB;
-        // @has 'foo/a/b/struct.FooInSuperSuper.html' '//pre' 'pub(crate) struct FooInSuperSuper'
-        pub(in super::super) struct FooInSuperSuper;
-        // @has 'foo/a/b/struct.FooInAB.html' '//pre' 'pub(in a::b) struct FooInAB'
-        pub(in a::b) struct FooInAB;
+        // @has 'foo/a/b/struct.FooBSuper.html' '//pre' 'pub(super) struct FooBSuper'
+        pub(super) struct FooBSuper;
+        // @has 'foo/a/b/struct.FooBInSuperSuper.html' '//pre' 'pub(crate) struct FooBInSuperSuper'
+        pub(in super::super) struct FooBInSuperSuper;
+        // @has 'foo/a/b/struct.FooBInAB.html' '//pre' 'struct FooBInAB'
+        pub(in a::b) struct FooBInAB;
     }
 }
diff --git a/src/test/rustdoc/visibility.rs b/src/test/rustdoc/visibility.rs
new file mode 100644
index 00000000000..9dd0b68b1d9
--- /dev/null
+++ b/src/test/rustdoc/visibility.rs
@@ -0,0 +1,13 @@
+// compile-flags: --document-private-items
+
+#![crate_name = "foo"]
+
+// @has 'foo/fn.foo.html' '//pre' 'fn foo'
+// !@has 'foo/fn.foo.html' '//pre' 'pub'
+fn foo() {}
+
+mod bar {
+    // @has 'foo/bar/fn.baz.html' '//pre' 'fn baz'
+    // !@has 'foo/bar/fn.baz.html' '//pre' 'pub'
+    fn baz() {}
+}