mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-25 19:03:30 +04:00
adding tests
This commit is contained in:
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…
Reference in New Issue
Block a user