Use single languages::{rust_lang, markdown_lang} in tests across the codebase (#44282)

This allows referencing proper queries and keeping the tests up-to-date.

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov
2025-12-06 18:49:21 +00:00
committed by GitHub
parent b2e35b5f99
commit 16666f5357
22 changed files with 267 additions and 830 deletions
+4 -16
View File
@@ -1951,7 +1951,7 @@ mod tests {
use super::*;
use fs::MTime;
use gpui::{App, VisualTestContext};
use language::{LanguageMatcher, TestFile};
use language::TestFile;
use project::FakeFs;
use std::path::{Path, PathBuf};
use util::{path, rel_path::RelPath};
@@ -1991,20 +1991,6 @@ mod tests {
.unwrap()
}
fn rust_language() -> Arc<language::Language> {
Arc::new(language::Language::new(
language::LanguageConfig {
name: "Rust".into(),
matcher: LanguageMatcher {
path_suffixes: vec!["rs".to_string()],
..Default::default()
},
..Default::default()
},
Some(tree_sitter_rust::LANGUAGE.into()),
))
}
#[gpui::test]
async fn test_deserialize(cx: &mut gpui::TestAppContext) {
init_test(cx, |_| {});
@@ -2086,7 +2072,9 @@ mod tests {
{
let project = Project::test(fs.clone(), [path!("/file.rs").as_ref()], cx).await;
// Add Rust to the language, so that we can restore the language of the buffer
project.read_with(cx, |project, _| project.languages().add(rust_language()));
project.read_with(cx, |project, _| {
project.languages().add(languages::rust_lang())
});
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));