Docs for Fixture

This commit is contained in:
Aleksey Kladov 2020-06-23 18:58:45 +02:00
parent 84cd28fddc
commit a34f9b7fb3
2 changed files with 5 additions and 2 deletions

View file

@ -17,7 +17,7 @@ use lsp_types::{ProgressParams, ProgressParamsValue};
use serde::Serialize; use serde::Serialize;
use serde_json::{to_string_pretty, Value}; use serde_json::{to_string_pretty, Value};
use tempfile::TempDir; use tempfile::TempDir;
use test_utils::{find_mismatch, parse_fixture}; use test_utils::{find_mismatch, Fixture};
use ra_project_model::ProjectManifest; use ra_project_model::ProjectManifest;
use rust_analyzer::{ use rust_analyzer::{
@ -68,7 +68,7 @@ impl<'a> Project<'a> {
let mut paths = vec![]; let mut paths = vec![];
for entry in parse_fixture(self.fixture) { for entry in Fixture::parse(self.fixture) {
let path = tmp_dir.path().join(&entry.path['/'.len_utf8()..]); let path = tmp_dir.path().join(&entry.path['/'.len_utf8()..]);
fs::create_dir_all(path.parent().unwrap()).unwrap(); fs::create_dir_all(path.parent().unwrap()).unwrap();
fs::write(path.as_path(), entry.text.as_bytes()).unwrap(); fs::write(path.as_path(), entry.text.as_bytes()).unwrap();

View file

@ -1,3 +1,6 @@
//! Defines `Fixture` -- a convenient way to describe the initial state of
//! rust-analyzer database from a single string.
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use stdx::split1; use stdx::split1;