Skip to content

Commit 8a5d144

Browse files
committed
Add fixture doc comment
1 parent e99447f commit 8a5d144

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

crates/ra_db/src/fixture.rs

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,48 @@
1-
//! FIXME: write short doc here
1+
//! Fixtures are strings containing rust source code with optional metadata.
2+
//! A fixture without metadata is parsed into a single source file.
3+
//! Use this to test functionality local to one file.
4+
//!
5+
//! Example:
6+
//! ```
7+
//! r#"
8+
//! fn main() {
9+
//! println!("Hello World")
10+
//! }
11+
//! "#
12+
//! ```
13+
//!
14+
//! Metadata can be added to a fixture after a `//-` comment.
15+
//! The basic form is specifying filenames,
16+
//! which is also how to define multiple files in a single test fixture
17+
//!
18+
//! Example:
19+
//! ```
20+
//! "
21+
//! //- /main.rs
22+
//! mod foo;
23+
//! fn main() {
24+
//! foo::bar();
25+
//! }
26+
//!
27+
//! //- /foo.rs
28+
//! pub fn bar() {}
29+
//! "
30+
//! ```
31+
//!
32+
//! Metadata allows specifying all settings and variables
33+
//! that are available in a real rust project:
34+
//! - crate names via `crate:cratename`
35+
//! - dependencies via `deps:dep1,dep2`
36+
//! - configuration settings via `cfg:dbg=false,opt_level=2`
37+
//! - environment variables via `env:PATH=/bin,RUST_LOG=debug`
38+
//!
39+
//! Example:
40+
//! ```
41+
//! "
42+
//! //- /lib.rs crate:foo deps:bar,baz cfg:foo=a,bar=b env:OUTDIR=path/to,OTHER=foo
43+
//! fn insert_source_code_here() {}
44+
//! "
45+
//! ```
246
347
use std::str::FromStr;
448
use std::sync::Arc;

xtask/tests/tidy.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ impl TidyDocs {
136136
}
137137

138138
let whitelist = [
139-
"ra_db",
140139
"ra_hir",
141140
"ra_hir_expand",
142141
"ra_ide",

0 commit comments

Comments
 (0)