mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
tests: Fix doctests in crates/component (#37716)
Previously, `cargo test --package component` failed due to missing
imports for a doctest:
```
Doc-tests component
running 1 test
test crates/component/src/component.rs - Component::description (line 229) ... FAILED
failures:
---- crates/component/src/component.rs - Component::description (line 229) stdout ----
error: cannot find derive macro `Documented` in this scope
--> crates/component/src/component.rs:231:10
|
4 | #[derive(Documented)]
| ^^^^^^^^^^
error[E0599]: no associated item named `DOCS` found for struct `MyComponent` in the current scope
--> crates/component/src/component.rs:236:20
|
5 | struct MyComponent;
| ------------------ associated item `DOCS` not found for this struct
...
9 | Some(Self::DOCS)
| ^^^^ associated item not found in `MyComponent`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0599`.
Couldn't compile the test.
failures:
crates/component/src/component.rs - Component::description (line 229)
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.29s
error: doctest failed, to rerun pass `-p component --doc`
bobcat ~/src/zed (doctests) 18:33
```
This might be unnoticed if you mostly run nextest, as it does not run
doctests.
Release Notes:
- N/A
This commit is contained in:
parent
c3d065cecc
commit
abac87c2f8
3 changed files with 6 additions and 0 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -3515,6 +3515,7 @@ name = "component"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"collections",
|
||||
"documented",
|
||||
"gpui",
|
||||
"inventory",
|
||||
"parking_lot",
|
||||
|
|
|
|||
|
|
@ -20,5 +20,8 @@ strum.workspace = true
|
|||
theme.workspace = true
|
||||
workspace-hack.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
documented.workspace = true
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
|
|
|||
|
|
@ -227,6 +227,8 @@ pub trait Component {
|
|||
/// Example:
|
||||
///
|
||||
/// ```
|
||||
/// use documented::Documented;
|
||||
///
|
||||
/// /// This is a doc comment.
|
||||
/// #[derive(Documented)]
|
||||
/// struct MyComponent;
|
||||
|
|
|
|||
Loading…
Reference in a new issue