mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Enable CfgOptions test
for workspace crates
This commit is contained in:
parent
b1ed887d81
commit
d2ea776b8f
9 changed files with 134 additions and 26 deletions
|
@ -49,6 +49,7 @@ mod test_utils;
|
|||
|
||||
use std::sync::Arc;
|
||||
|
||||
use ra_cfg::CfgOptions;
|
||||
use ra_db::{
|
||||
salsa::{self, ParallelDatabase},
|
||||
CheckCanceled, SourceDatabase,
|
||||
|
@ -322,7 +323,10 @@ impl Analysis {
|
|||
change.add_root(source_root, true);
|
||||
let mut crate_graph = CrateGraph::default();
|
||||
let file_id = FileId(0);
|
||||
crate_graph.add_crate_root(file_id, Edition::Edition2018);
|
||||
// FIXME: cfg options
|
||||
// Default to enable test for single file.
|
||||
let cfg_options = CfgOptions::default().atom("test".into());
|
||||
crate_graph.add_crate_root(file_id, Edition::Edition2018, cfg_options);
|
||||
change.add_file(source_root, file_id, "main.rs".into(), Arc::new(text));
|
||||
change.set_crate_graph(crate_graph);
|
||||
host.apply_change(change);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue