# tests: Fix doctests in crates/component \(\#37716\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/abac87c2f891c48ac0652e343d58642a88cc165f)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: abac87c2f891c48ac0652e343d58642a88cc165f

Requested commit: abac87c2f891c48ac0652e343d58642a88cc165f

Commit: abac87c2f891c48ac0652e343d58642a88cc165f

Tree: 7cc275a913613a12d23278156ecc7577c86225db

Author: Martin Pool

Committer: GitHub

## Message

````
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
````

## Parents

- [c3d065cecc107c5e88778301345ec2f181f9cbf6](https://git.cafe/gitcafe/zed/commit/c3d065cecc107c5e88778301345ec2f181f9cbf6?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/abac87c2f891c48ac0652e343d58642a88cc165f?format=markdown)
