adding tests

pull/11164/head
Théo Daron 4 months ago
parent 0e6144567c
commit c2172847b2

@ -1,5 +1,5 @@
use super::*;
use std::borrow::Cow;
#[tokio::test(flavor = "multi_thread")]
async fn test_variable_expansion() -> anyhow::Result<()> {
{
@ -19,8 +19,6 @@ async fn test_variable_expansion() -> anyhow::Result<()> {
.await?;
let mut app = AppBuilder::new().build()?;
let mut app = AppBuilder::new().build()?;
test_key_sequence(
&mut app,
Some("<esc>:echo %{basename}<ret>"),
@ -128,6 +126,57 @@ async fn test_variable_expansion() -> anyhow::Result<()> {
false,
)
.await?;
let mut app = AppBuilder::new().build()?;
test_key_sequence(
&mut app,
Some("<esc>:echo %sh{echo %{filename}}<ret>"),
Some(&|app| {
assert_eq!(
app.editor.get_status().unwrap().0,
helix_view::document::SCRATCH_BUFFER_NAME
);
}),
false,
)
.await?;
let mut app = AppBuilder::new().build()?;
test_key_sequence(
&mut app,
Some("<esc>:echo %sh{echo %{filename} %{linenumber}}<ret>"),
Some(&|app| {
assert_eq!(
app.editor.get_status().unwrap().0,
&Cow::from(format!(
"{} {}",
helix_view::document::SCRATCH_BUFFER_NAME,
1
))
);
}),
false,
)
.await?;
let mut app = AppBuilder::new().build()?;
test_key_sequence(
&mut app,
Some("<esc>:echo %sh{echo %{filename} %sh{echo %{filename}}}<ret>"),
Some(&|app| {
assert_eq!(
app.editor.get_status().unwrap().0,
&Cow::from(format!(
"{} {}",
helix_view::document::SCRATCH_BUFFER_NAME,
helix_view::document::SCRATCH_BUFFER_NAME
))
);
}),
false,
)
.await?;
}
Ok(())

Loading…
Cancel
Save