Skip to content

Commit

Permalink
Add test for enum tuple variants and tuple struct doc count
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Sep 10, 2021
1 parent 64344cc commit eda4cfb
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 2 deletions.
37 changes: 37 additions & 0 deletions src/test/rustdoc-ui/coverage/enum-tuple-documented.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// compile-flags:-Z unstable-options --show-coverage
// check-pass

// The point of this test is to ensure that the number of "documented" items
// is higher than in `enum-tuple.rs`.

//! (remember the crate root is still a module)
/// so check out this enum here
pub enum ThisEnum {
/// VarOne.
VarOne(
/// hello!
String,
),
/// Var Two.
VarTwo(
/// Hello
String,
/// Bis repetita.
String,
),
}

/// Struct.
pub struct ThisStruct(
/// hello
u32,
);

/// Struct.
pub struct ThisStruct2(
/// hello
u32,
/// Bis repetita.
u8,
);
7 changes: 7 additions & 0 deletions src/test/rustdoc-ui/coverage/enum-tuple-documented.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
+-------------------------------------+------------+------------+------------+------------+
| File | Documented | Percentage | Examples | Percentage |
+-------------------------------------+------------+------------+------------+------------+
| ...overage/enum-tuple-documented.rs | 9 | 100.0% | 0 | 0.0% |
+-------------------------------------+------------+------------+------------+------------+
| Total | 9 | 100.0% | 0 | 0.0% |
+-------------------------------------+------------+------------+------------+------------+
18 changes: 18 additions & 0 deletions src/test/rustdoc-ui/coverage/enum-tuple.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// compile-flags:-Z unstable-options --show-coverage
// check-pass

//! (remember the crate root is still a module)
/// so check out this enum here
pub enum ThisEnum {
/// No need to document the field if there is only one in a tuple variant!
VarOne(String),
/// But if there is more than one... still fine!
VarTwo(String, String),
}

/// Struct.
pub struct ThisStruct(u32);

/// Struct.
pub struct ThisStruct2(u32, u8);
7 changes: 7 additions & 0 deletions src/test/rustdoc-ui/coverage/enum-tuple.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
+-------------------------------------+------------+------------+------------+------------+
| File | Documented | Percentage | Examples | Percentage |
+-------------------------------------+------------+------------+------------+------------+
| ...ustdoc-ui/coverage/enum-tuple.rs | 6 | 100.0% | 0 | 0.0% |
+-------------------------------------+------------+------------+------------+------------+
| Total | 6 | 100.0% | 0 | 0.0% |
+-------------------------------------+------------+------------+------------+------------+
4 changes: 2 additions & 2 deletions src/test/rustdoc-ui/coverage/enums.stdout
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
+-------------------------------------+------------+------------+------------+------------+
| File | Documented | Percentage | Examples | Percentage |
+-------------------------------------+------------+------------+------------+------------+
| ...est/rustdoc-ui/coverage/enums.rs | 6 | 66.7% | 0 | 0.0% |
| ...est/rustdoc-ui/coverage/enums.rs | 6 | 75.0% | 0 | 0.0% |
+-------------------------------------+------------+------------+------------+------------+
| Total | 6 | 66.7% | 0 | 0.0% |
| Total | 6 | 75.0% | 0 | 0.0% |
+-------------------------------------+------------+------------+------------+------------+

0 comments on commit eda4cfb

Please sign in to comment.