Rebuilt from the exact zed-industries/zed @ 8c74db00c4053d6c0a9037863d7bd048658da4ca tree (previous orphan was based on a stale/wrong fetch). Same 3-file patch: - serial.rs: add SerialKind::KeyboardEnter - client.rs: store wl_keyboard.enter serial; add latest_serial_of() - window.rs: activate() uses keyboard-enter serial (Mutter focus gate) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
75 lines
2.2 KiB
Rust
75 lines
2.2 KiB
Rust
use std::path::Path;
|
|
|
|
use language::{CodeLabel, HighlightId};
|
|
|
|
use project::lsp_store::*;
|
|
|
|
#[test]
|
|
fn test_glob_literal_prefix() {
|
|
assert_eq!(glob_literal_prefix(Path::new("**/*.js")), Path::new(""));
|
|
assert_eq!(
|
|
glob_literal_prefix(Path::new("node_modules/**/*.js")),
|
|
Path::new("node_modules")
|
|
);
|
|
assert_eq!(
|
|
glob_literal_prefix(Path::new("foo/{bar,baz}.js")),
|
|
Path::new("foo")
|
|
);
|
|
assert_eq!(
|
|
glob_literal_prefix(Path::new("foo/bar/baz.js")),
|
|
Path::new("foo/bar/baz.js")
|
|
);
|
|
|
|
#[cfg(target_os = "windows")]
|
|
{
|
|
assert_eq!(glob_literal_prefix(Path::new("**\\*.js")), Path::new(""));
|
|
assert_eq!(
|
|
glob_literal_prefix(Path::new("node_modules\\**/*.js")),
|
|
Path::new("node_modules")
|
|
);
|
|
assert_eq!(
|
|
glob_literal_prefix(Path::new("foo/{bar,baz}.js")),
|
|
Path::new("foo")
|
|
);
|
|
assert_eq!(
|
|
glob_literal_prefix(Path::new("foo\\bar\\baz.js")),
|
|
Path::new("foo/bar/baz.js")
|
|
);
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn test_multi_len_chars_normalization() {
|
|
let mut label = CodeLabel::new(
|
|
"myElˇ (parameter) myElˇ: {\n foo: string;\n}".to_string(),
|
|
0..6,
|
|
vec![(0..6, HighlightId::new(1))],
|
|
);
|
|
ensure_uniform_list_compatible_label(&mut label);
|
|
assert_eq!(
|
|
label,
|
|
CodeLabel::new(
|
|
"myElˇ (parameter) myElˇ: { foo: string; }".to_string(),
|
|
0..6,
|
|
vec![(0..6, HighlightId::new(1))],
|
|
)
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn test_trailing_newline_in_completion_documentation() {
|
|
let doc =
|
|
lsp::Documentation::String("Inappropriate argument value (of correct type).\n".to_string());
|
|
let completion_doc: CompletionDocumentation = doc.into();
|
|
assert!(
|
|
matches!(completion_doc, CompletionDocumentation::SingleLine(s) if s == "Inappropriate argument value (of correct type).")
|
|
);
|
|
|
|
let doc = lsp::Documentation::String(" some value \n".to_string());
|
|
let completion_doc: CompletionDocumentation = doc.into();
|
|
assert!(matches!(
|
|
completion_doc,
|
|
CompletionDocumentation::SingleLine(s) if s == "some value"
|
|
));
|
|
}
|