Struct ra_ap_test_utils::Fixture
source · pub struct Fixture {
pub path: String,
pub krate: Option<String>,
pub deps: Vec<String>,
pub extern_prelude: Option<Vec<String>>,
pub cfgs: Vec<(String, Option<String>)>,
pub edition: Option<String>,
pub env: FxHashMap<String, String>,
pub introduce_new_source_root: Option<String>,
pub library: bool,
pub target_data_layout: Option<String>,
pub text: String,
}
Fields§
§path: String
Specifies the path for this file. It must start with “/”.
krate: Option<String>
Defines a new crate and make this file its root module.
Version and repository URL of the crate can optionally be specified; if either one is specified, the other must also be specified.
Syntax:
crate:my_awesome_lib
crate:my_awesome_lib@0.0.1,https://example.com/repo.git
deps: Vec<String>
Specifies dependencies of this crate. This must be used with crate
meta.
Syntax: deps:hir-def,ide-assists
extern_prelude: Option<Vec<String>>
Limits crates in the extern prelude. The set of crate names must be a
subset of deps
. This must be used with crate
meta.
If this is not specified, all the dependencies will be in the extern prelude.
Syntax: extern-prelude:hir-def,ide-assists
cfgs: Vec<(String, Option<String>)>
Specifies configuration options to be enabled. Options may have associated values.
Syntax: cfg:test,dbg=false,opt_level=2
edition: Option<String>
Specifies the edition of this crate. This must be used with crate
meta. If
this is not specified, ([base_db::input::Edition::CURRENT
]) will be used.
This must be used with crate
meta.
Syntax: edition:2021
env: FxHashMap<String, String>
Specifies environment variables.
Syntax: env:PATH=/bin,RUST_LOG=debug
introduce_new_source_root: Option<String>
Introduces a new source root. This file and
the following files will belong the new source root. This must be used
with crate
meta.
Use this if you want to test something that uses SourceRoot::is_library()
to check editability.
Note that files before the first fixture with new_source_root
meta will
belong to an implicitly defined local source root.
Syntax:
new_source_root:library
new_source_root:local
library: bool
Explicitly declares this crate as a library outside current workspace. This
must be used with crate
meta.
This is implied if this file belongs to a library source root.
Use this if you want to test something that checks if a crate is a workspace
member via CrateOrigin
.
Syntax: library
target_data_layout: Option<String>
Specifies LLVM data layout to be used.
You probably don’t want to manually specify this. See LLVM manual for the syntax, if you must: https://llvm.org/docs/LangRef.html#data-layout
text: String
Actual file contents. All meta comments are stripped.