Skip to content

Commit e17193d

Browse files
committed
Expand fixture documentation a little
1 parent 66db88d commit e17193d

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

crates/ra_db/src/fixture.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//! A fixture without metadata is parsed into a single source file.
33
//! Use this to test functionality local to one file.
44
//!
5-
//! Example:
5+
//! Simple Example:
66
//! ```
77
//! r#"
88
//! fn main() {
@@ -15,7 +15,7 @@
1515
//! The basic form is specifying filenames,
1616
//! which is also how to define multiple files in a single test fixture
1717
//!
18-
//! Example:
18+
//! Example using two files in the same crate:
1919
//! ```
2020
//! "
2121
//! //- /main.rs
@@ -29,14 +29,28 @@
2929
//! "
3030
//! ```
3131
//!
32+
//! Example using two crates with one file each, with one crate depending on the other:
33+
//! ```
34+
//! r#"
35+
//! //- /main.rs crate:a deps:b
36+
//! fn main() {
37+
//! b::foo();
38+
//! }
39+
//! //- /lib.rs crate:b
40+
//! pub fn b() {
41+
//! println!("Hello World")
42+
//! }
43+
//! "#
44+
//! ```
45+
//!
3246
//! Metadata allows specifying all settings and variables
3347
//! that are available in a real rust project:
3448
//! - crate names via `crate:cratename`
3549
//! - dependencies via `deps:dep1,dep2`
3650
//! - configuration settings via `cfg:dbg=false,opt_level=2`
3751
//! - environment variables via `env:PATH=/bin,RUST_LOG=debug`
3852
//!
39-
//! Example:
53+
//! Example using all available metadata:
4054
//! ```
4155
//! "
4256
//! //- /lib.rs crate:foo deps:bar,baz cfg:foo=a,bar=b env:OUTDIR=path/to,OTHER=foo

0 commit comments

Comments
 (0)