Skip to content

Commit

Permalink
Update missing-doc test to explicitly check errors
Browse files Browse the repository at this point in the history
This way we can be sure the correct error is displayed for the
respective code type.
  • Loading branch information
ipetkov committed Feb 23, 2015
1 parent 717a91d commit 2e9521c
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/test/compile-fail/lint-missing-doc.rs
Expand Up @@ -17,15 +17,15 @@
#![doc="More garbage"]

type Typedef = String;
pub type PubTypedef = String; //~ ERROR: missing documentation
pub type PubTypedef = String; //~ ERROR: missing documentation for a type alias

struct Foo {
a: isize,
b: isize,
}

pub struct PubFoo { //~ ERROR: missing documentation
pub a: isize, //~ ERROR: missing documentation
pub struct PubFoo { //~ ERROR: missing documentation for a struct
pub a: isize, //~ ERROR: missing documentation for a struct field
b: isize,
}

Expand All @@ -36,11 +36,11 @@ pub struct PubFoo2 {
}

mod module_no_dox {}
pub mod pub_module_no_dox {} //~ ERROR: missing documentation
pub mod pub_module_no_dox {} //~ ERROR: missing documentation for a module

/// dox
pub fn foo() {}
pub fn foo2() {} //~ ERROR: missing documentation
pub fn foo2() {} //~ ERROR: missing documentation for a function
fn foo3() {}
#[allow(missing_docs)] pub fn foo4() {}

Expand All @@ -58,9 +58,9 @@ trait B {
fn foo_with_impl(&self) {}
}

pub trait C { //~ ERROR: missing documentation
fn foo(&self); //~ ERROR: missing documentation
fn foo_with_impl(&self) {} //~ ERROR: missing documentation
pub trait C { //~ ERROR: missing documentation for a trait
fn foo(&self); //~ ERROR: missing documentation for a type method
fn foo_with_impl(&self) {} //~ ERROR: missing documentation for a method
}

#[allow(missing_docs)]
Expand All @@ -70,8 +70,8 @@ pub trait D {

/// dox
pub trait E {
type AssociatedType; //~ ERROR: missing documentation
type AssociatedTypeDef = Self; //~ ERROR: missing documentation
type AssociatedType; //~ ERROR: missing documentation for an associated type
type AssociatedTypeDef = Self; //~ ERROR: missing documentation for an associated type

/// dox
type DocumentedType;
Expand All @@ -87,7 +87,7 @@ impl Foo {
}

impl PubFoo {
pub fn foo() {} //~ ERROR: missing documentation
pub fn foo() {} //~ ERROR: missing documentation for a method
/// dox
pub fn foo1() {}
fn foo2() {}
Expand Down Expand Up @@ -124,9 +124,9 @@ enum Baz {
BarB
}

pub enum PubBaz { //~ ERROR: missing documentation
PubBazA { //~ ERROR: missing documentation
a: isize, //~ ERROR: missing documentation
pub enum PubBaz { //~ ERROR: missing documentation for an enum
PubBazA { //~ ERROR: missing documentation for a variant
a: isize, //~ ERROR: missing documentation for a struct field
},
}

Expand All @@ -152,14 +152,14 @@ pub fn baz() {}
mod internal_impl {
/// dox
pub fn documented() {}
pub fn undocumented1() {} //~ ERROR: missing documentation
pub fn undocumented2() {} //~ ERROR: missing documentation
pub fn undocumented1() {} //~ ERROR: missing documentation for a function
pub fn undocumented2() {} //~ ERROR: missing documentation for a function
fn undocumented3() {}
/// dox
pub mod globbed {
/// dox
pub fn also_documented() {}
pub fn also_undocumented1() {} //~ ERROR: missing documentation
pub fn also_undocumented1() {} //~ ERROR: missing documentation for a function
fn also_undocumented2() {}
}
}
Expand Down

0 comments on commit 2e9521c

Please sign in to comment.