Skip to content

Commit

Permalink
BE: remove scratch_buffer from test fixture parsing
Browse files Browse the repository at this point in the history
Summary: As title

Reviewed By: TheGeorge

Differential Revision: D67456076

fbshipit-source-id: 79e4de801c7afb605c426c2a99d5f8f15819b5a4
  • Loading branch information
alanz authored and facebook-github-bot committed Dec 19, 2024
1 parent 42d39ce commit 0ce3b19
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
3 changes: 0 additions & 3 deletions crates/base_db/src/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,6 @@ impl ChangeFixture {

for entry in fixture.clone() {
let (text, file_pos) = Self::get_text_and_pos(&entry.text, file_id);
if entry.scratch_buffer.is_some() {
panic!("scratch buffers no longer needed/supported");
}
if file_pos.is_some() {
assert!(file_position.is_none());
file_position = file_pos;
Expand Down
15 changes: 1 addition & 14 deletions crates/project_model/src/test_fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,12 @@
use std::fs;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;

use paths::AbsPath;
use paths::AbsPathBuf;
use paths::Utf8Path;
use paths::Utf8PathBuf;
pub use stdx::trim_indent;
use tempfile::tempdir;
use text_size::TextRange;
use text_size::TextSize;

Expand All @@ -106,7 +104,6 @@ pub struct Fixture {
pub text: String,
pub app_data: ProjectAppData,
pub otp: Option<Otp>,
pub scratch_buffer: Option<PathBuf>,
pub tag: Option<String>,
pub tags: Vec<(TextRange, Option<String>)>,
}
Expand Down Expand Up @@ -321,7 +318,7 @@ impl FixtureWithProjectMeta {
let meta = meta["//-".len()..].trim();
let components = meta.split_ascii_whitespace().collect::<Vec<_>>();

let mut path = components[0].to_string();
let path = components[0].to_string();
assert!(
path.starts_with('/'),
"fixture path does not start with `/`: {:?}",
Expand All @@ -332,7 +329,6 @@ impl FixtureWithProjectMeta {
let mut include_dirs = Vec::new();
let mut extra_dirs = Vec::new();
let mut otp = None;
let mut scratch_buffer = None;
let mut tag = None;

for component in components[1..].iter() {
Expand All @@ -358,14 +354,6 @@ impl FixtureWithProjectMeta {
let dir = value.to_string();
extra_dirs.push(dir);
}
"scratch_buffer" => {
// Certain features depending on the Erlang Service
// require a physical copy of the file on the FS
let tmp_dir = tempdir().unwrap();
let tmp_path = tmp_dir.path().join(path.strip_prefix('/').unwrap());
path = tmp_path.to_str().unwrap().to_string();
scratch_buffer = Some(tmp_path);
}
"tag" => {
tag = Some(value.to_string());
}
Expand Down Expand Up @@ -401,7 +389,6 @@ impl FixtureWithProjectMeta {
text: String::new(),
app_data,
otp,
scratch_buffer,
tag,
tags: Vec::new(),
}
Expand Down

0 comments on commit 0ce3b19

Please sign in to comment.