Skip to content

Commit

Permalink
Add visibility tests for associated items
Browse files Browse the repository at this point in the history
  • Loading branch information
wackbyte committed Apr 29, 2023
1 parent c404984 commit 16749d1
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/rustdoc/visibility.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// compile-flags: --document-private-items

#![crate_name = "foo"]
#![feature(inherent_associated_types)]
#![allow(incomplete_features)]

// @!has 'foo/index.html' '//a[@href="struct.FooPublic.html"]/..' 'FooPublic 🔒'
// @has 'foo/struct.FooPublic.html' '//pre' 'pub struct FooPublic'
Expand Down Expand Up @@ -103,3 +105,26 @@ impl PubTrait for FooPublic {
const CONST: usize = 0;
fn function() {}
}

pub struct Assoc;

// @has foo/struct.Assoc.html
impl Assoc {
// @has - '//*[@id="associatedtype.TypePub"]' 'pub type TypePub'
pub type TypePub = usize;

// @has - '//*[@id="associatedtype.TypePriv"]' 'pub(crate) type TypePriv'
type TypePriv = usize;

// @has - '//*[@id="associatedconstant.CONST_PUB"]' 'pub const CONST_PUB'
pub const CONST_PUB: usize = 0;

// @has - '//*[@id="associatedconstant.CONST_PRIV"]' 'pub(crate) const CONST_PRIV'
const CONST_PRIV: usize = 0;

// @has - '//*[@id="method.function_pub"]' 'pub fn function_pub()'
pub fn function_pub() {}

// @has - '//*[@id="method.function_priv"]' 'pub(crate) fn function_priv()'
fn function_priv() {}
}

0 comments on commit 16749d1

Please sign in to comment.