mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-09 21:26:14 +03:00
Add test that loads all bundled languages
This commit is contained in:
parent
7c98395e77
commit
8be844a13f
@ -1017,6 +1017,24 @@ impl Language {
|
||||
))?;
|
||||
}
|
||||
|
||||
for disabled_scope_name in self
|
||||
.config
|
||||
.brackets
|
||||
.disabled_scopes_by_bracket_ix
|
||||
.iter()
|
||||
.flatten()
|
||||
{
|
||||
if !override_configs_by_id
|
||||
.values()
|
||||
.any(|(scope_name, _)| scope_name == disabled_scope_name)
|
||||
{
|
||||
Err(anyhow!(
|
||||
"language {:?} has overrides in config not in query: {disabled_scope_name:?}",
|
||||
self.config.name
|
||||
))?;
|
||||
}
|
||||
}
|
||||
|
||||
for (name, override_config) in override_configs_by_id.values_mut() {
|
||||
override_config.disabled_bracket_ixs = self
|
||||
.config
|
||||
|
@ -701,8 +701,9 @@ mod tests {
|
||||
use assets::Assets;
|
||||
use editor::{scroll::autoscroll::Autoscroll, DisplayPoint, Editor};
|
||||
use gpui::{
|
||||
executor::Deterministic, AssetSource, MutableAppContext, TestAppContext, ViewHandle,
|
||||
executor::Deterministic, AssetSource, MutableAppContext, Task, TestAppContext, ViewHandle,
|
||||
};
|
||||
use language::LanguageRegistry;
|
||||
use project::{Project, ProjectPath};
|
||||
use serde_json::json;
|
||||
use std::{
|
||||
@ -1886,6 +1887,18 @@ mod tests {
|
||||
assert!(has_default_theme);
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn test_bundled_languages(cx: &mut MutableAppContext) {
|
||||
let mut languages = LanguageRegistry::new(Task::ready(()));
|
||||
languages.set_executor(cx.background().clone());
|
||||
let languages = Arc::new(languages);
|
||||
languages::init(languages.clone());
|
||||
for name in languages.language_names() {
|
||||
languages.language_for_name(&name);
|
||||
}
|
||||
cx.foreground().run_until_parked();
|
||||
}
|
||||
|
||||
fn init(cx: &mut TestAppContext) -> Arc<AppState> {
|
||||
cx.foreground().forbid_parking();
|
||||
cx.update(|cx| {
|
||||
|
Loading…
Reference in New Issue
Block a user