mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-08 18:35:06 +03:00
Remove test
This commit is contained in:
parent
5b6582a7c2
commit
ee9123a7da
@ -134,64 +134,3 @@ async fn get_cached_server_binary(
|
||||
.await
|
||||
.log_err()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use gpui::TestAppContext;
|
||||
use unindent::Unindent;
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_outline(cx: &mut TestAppContext) {
|
||||
let language = crate::languages::language("php", tree_sitter_php::language(), None).await;
|
||||
|
||||
/*let text = r#"
|
||||
function a() {
|
||||
// local variables are omitted
|
||||
let a1 = 1;
|
||||
// all functions are included
|
||||
async function a2() {}
|
||||
}
|
||||
// top-level variables are included
|
||||
let b: C
|
||||
function getB() {}
|
||||
// exported variables are included
|
||||
export const d = e;
|
||||
"#
|
||||
.unindent();*/
|
||||
let text = r#"
|
||||
function a() {
|
||||
// local variables are omitted
|
||||
$a1 = 1;
|
||||
// all functions are included
|
||||
function a2() {}
|
||||
}
|
||||
class Foo {}
|
||||
"#
|
||||
.unindent();
|
||||
let buffer =
|
||||
cx.add_model(|cx| language::Buffer::new(0, text, cx).with_language(language, cx));
|
||||
let outline = buffer.read_with(cx, |buffer, _| buffer.snapshot().outline(None).unwrap());
|
||||
panic!(
|
||||
"{:?}",
|
||||
outline
|
||||
.items
|
||||
.iter()
|
||||
.map(|item| (item.text.as_str(), item.depth))
|
||||
.collect::<Vec<_>>()
|
||||
);
|
||||
assert_eq!(
|
||||
outline
|
||||
.items
|
||||
.iter()
|
||||
.map(|item| (item.text.as_str(), item.depth))
|
||||
.collect::<Vec<_>>(),
|
||||
&[
|
||||
("function a()", 0),
|
||||
("async function a2()", 1),
|
||||
("let b", 0),
|
||||
("function getB()", 0),
|
||||
("const d", 0),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user