Skip to content

Commit

Permalink
check all lens
Browse files Browse the repository at this point in the history
  • Loading branch information
LoricAndre committed Nov 30, 2024
1 parent 2430374 commit dc6a8ea
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 130 deletions.
8 changes: 4 additions & 4 deletions e2e/tests/binds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn bind_append_and_select() -> Result<()> {
let tmux = setup("a\\n\\nb\\nc", &["-m", "--bind", "'ctrl-f:append-and-select'"])?;

tmux.send_keys(&[Str("xyz"), Ctrl(&Key('f'))])?;
tmux.until(|l| l[2] == ">>xyz")?;
tmux.until(|l| l.len() > 2 && l[2] == ">>xyz")?;

Ok(())
}
Expand All @@ -70,7 +70,7 @@ fn bind_reload_no_arg() -> Result<()> {
tmux.until(|l| l[0].starts_with(">"))?;

tmux.send_keys(&[Ctrl(&Key('a'))])?;
tmux.until(|l| l[2] == "> hello")?;
tmux.until(|l| l.len() > 2 && l[2] == "> hello")?;

Ok(())
}
Expand All @@ -79,9 +79,9 @@ fn bind_reload_no_arg() -> Result<()> {
fn bind_reload_cmd() -> Result<()> {
let tmux = setup("a\\n\\nb\\nc", &["--bind", "'ctrl-a:reload(echo hello)'"])?;

tmux.until(|l| l[2] == "> a")?;
tmux.until(|l| l.len() > 2 && l[2] == "> a")?;
tmux.send_keys(&[Ctrl(&Key('a'))])?;
tmux.until(|l| l[2] == "> hello")?;
tmux.until(|l| l.len() > 2 && l[2] == "> hello")?;

Ok(())
}
20 changes: 10 additions & 10 deletions e2e/tests/case.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,70 +14,70 @@ fn case_smart_lower() -> Result<()> {
let tmux = setup("smart")?;

tmux.send_keys(&[Str("abc")])?;
tmux.until(|l| l[1].trim().starts_with("1/1"))
tmux.until(|l| l.len() > 1 && l[1].trim().starts_with("1/1"))
}
#[test]
fn case_smart_exact() -> Result<()> {
let tmux = setup("smart")?;

tmux.send_keys(&[Str("aBc")])?;
tmux.until(|l| l[1].trim().starts_with("1/1"))
tmux.until(|l| l.len() > 1 && l[1].trim().starts_with("1/1"))
}
#[test]
fn case_smart_no_match() -> Result<()> {
let tmux = setup("smart")?;

tmux.send_keys(&[Str("Abc")])?;
tmux.until(|l| l[1].trim().starts_with("0/1"))
tmux.until(|l| l.len() > 1 && l[1].trim().starts_with("0/1"))
}

#[test]
fn case_ignore_lower() -> Result<()> {
let tmux = setup("ignore")?;

tmux.send_keys(&[Str("abc")])?;
tmux.until(|l| l[1].trim().starts_with("1/1"))
tmux.until(|l| l.len() > 1 && l[1].trim().starts_with("1/1"))
}
#[test]
fn case_ignore_exact() -> Result<()> {
let tmux = setup("ignore")?;

tmux.send_keys(&[Str("aBc")])?;
tmux.until(|l| l[1].trim().starts_with("1/1"))
tmux.until(|l| l.len() > 1 && l[1].trim().starts_with("1/1"))
}
#[test]
fn case_ignore_different() -> Result<()> {
let tmux = setup("ignore")?;

tmux.send_keys(&[Str("Abc")])?;
tmux.until(|l| l[1].trim().starts_with("1/1"))
tmux.until(|l| l.len() > 1 && l[1].trim().starts_with("1/1"))
}
#[test]
fn case_ignore_no_match() -> Result<()> {
let tmux = setup("ignore")?;

tmux.send_keys(&[Str("z")])?;
tmux.until(|l| l[1].trim().starts_with("0/1"))
tmux.until(|l| l.len() > 1 && l[1].trim().starts_with("0/1"))
}

#[test]
fn case_respect_lower() -> Result<()> {
let tmux = setup("respect")?;

tmux.send_keys(&[Str("abc")])?;
tmux.until(|l| l[1].trim().starts_with("0/1"))
tmux.until(|l| l.len() > 1 && l[1].trim().starts_with("0/1"))
}
#[test]
fn case_respect_exact() -> Result<()> {
let tmux = setup("respect")?;

tmux.send_keys(&[Str("aBc")])?;
tmux.until(|l| l[1].trim().starts_with("1/1"))
tmux.until(|l| l.len() > 1 && l[1].trim().starts_with("1/1"))
}
#[test]
fn case_respect_no_match() -> Result<()> {
let tmux = setup("respect")?;

tmux.send_keys(&[Str("Abc")])?;
tmux.until(|l| l[1].trim().starts_with("0/1"))
tmux.until(|l| l.len() > 1 && l[1].trim().starts_with("0/1"))
}
4 changes: 2 additions & 2 deletions e2e/tests/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ fn default_command() -> Result<()> {
let sk_cmd = sk(&outfile, &[]).replace("SKIM_DEFAULT_COMMAND=", "SKIM_DEFAULT_COMMAND='echo hello'");
tmux.send_keys(&[Keys::Str(&sk_cmd), Keys::Enter])?;
tmux.until(|l| l[0].starts_with(">"))?;
tmux.until(|l| l[1].starts_with(" 1/1"))?;
tmux.until(|l| l[2] == "> hello")?;
tmux.until(|l| l.len() > 1 && l[1].starts_with(" 1/1"))?;
tmux.until(|l| l.len() > 2 && l[2] == "> hello")?;

tmux.send_keys(&[Keys::Enter])?;
tmux.until(|l| !l[0].starts_with(">"))?;
Expand Down
20 changes: 10 additions & 10 deletions e2e/tests/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ fn keys_basic() -> Result<()> {
tmux.until(|l| l[0].starts_with(">") && l[1].starts_with(" 100000"))?;
tmux.send_keys(&[Str("99")])?;
tmux.until(|l| l[0] == "> 99")?;
tmux.until(|l| l[1].starts_with(" 8146/100000"))?;
tmux.until(|l| l[2] == "> 99")?;
tmux.until(|l| l.len() > 1 && l[1].starts_with(" 8146/100000"))?;
tmux.until(|l| l.len() > 2 && l[2] == "> 99")?;

Ok(())
}
Expand Down Expand Up @@ -193,8 +193,8 @@ fn keys_ctrl_k() -> Result<()> {
let _ = tmux.start_sk(Some("seq 1 100000"), &[]);
tmux.until(|l| l[0].starts_with(">") && l[1].starts_with(" 100000"))?;
tmux.send_keys(&[Ctrl(&Key('k'))])?;
tmux.until(|l| l[2] == " 1")?;
tmux.until(|l| l[3] == "> 2")?;
tmux.until(|l| l.len() > 2 && l[2] == " 1")?;
tmux.until(|l| l.len() > 3 && l[3] == "> 2")?;

Ok(())
}
Expand All @@ -205,12 +205,12 @@ fn keys_tab() -> Result<()> {
let _ = tmux.start_sk(Some("seq 1 100000"), &[]);
tmux.until(|l| l[0].starts_with(">") && l[1].starts_with(" 100000"))?;
tmux.send_keys(&[Ctrl(&Key('k'))])?;
tmux.until(|l| l[2] == " 1")?;
tmux.until(|l| l[3] == "> 2")?;
tmux.until(|l| l.len() > 2 && l[2] == " 1")?;
tmux.until(|l| l.len() > 3 && l[3] == "> 2")?;

tmux.send_keys(&[Tab])?;
tmux.until(|l| l[2] == "> 1")?;
tmux.until(|l| l[3] == " 2")?;
tmux.until(|l| l.len() > 2 && l[2] == "> 1")?;
tmux.until(|l| l.len() > 3 && l[3] == " 2")?;

Ok(())
}
Expand All @@ -221,8 +221,8 @@ fn keys_btab() -> Result<()> {
let _ = tmux.start_sk(Some("seq 1 100000"), &[]);
tmux.until(|l| l[0].starts_with(">") && l[1].starts_with(" 100000"))?;
tmux.send_keys(&[BTab])?;
tmux.until(|l| l[2] == " 1")?;
tmux.until(|l| l[3] == "> 2")?;
tmux.until(|l| l.len() > 2 && l[2] == " 1")?;
tmux.until(|l| l.len() > 3 && l[3] == "> 2")?;

Ok(())
}
Expand Down
20 changes: 10 additions & 10 deletions e2e/tests/keys_interactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ fn keys_interactive_basic() -> Result<()> {
tmux.until(|l| l[0].starts_with("c>") && l[1].starts_with(" 100000"))?;
tmux.send_keys(&[Str("99")])?;
tmux.until(|l| l[0] == "c> 99")?;
tmux.until(|l| l[1].starts_with(" 100000/100000"))?;
tmux.until(|l| l[2] == "> 1")?;
tmux.until(|l| l.len() > 1 && l[1].starts_with(" 100000/100000"))?;
tmux.until(|l| l.len() > 2 && l[2] == "> 1")?;

Ok(())
}
Expand Down Expand Up @@ -193,8 +193,8 @@ fn keys_interactive_ctrl_k() -> Result<()> {
let _ = tmux.start_sk(Some("seq 1 100000"), &["-i"]);
tmux.until(|l| l[0].starts_with("c>") && l[1].starts_with(" 100000"))?;
tmux.send_keys(&[Ctrl(&Key('k'))])?;
tmux.until(|l| l[2] == " 1")?;
tmux.until(|l| l[3] == "> 2")?;
tmux.until(|l| l.len() > 2 && l[2] == " 1")?;
tmux.until(|l| l.len() > 3 && l[3] == "> 2")?;

Ok(())
}
Expand All @@ -205,12 +205,12 @@ fn keys_interactive_tab() -> Result<()> {
let _ = tmux.start_sk(Some("seq 1 100000"), &["-i"]);
tmux.until(|l| l[0].starts_with("c>") && l[1].starts_with(" 100000"))?;
tmux.send_keys(&[Ctrl(&Key('k'))])?;
tmux.until(|l| l[2] == " 1")?;
tmux.until(|l| l[3] == "> 2")?;
tmux.until(|l| l.len() > 2 && l[2] == " 1")?;
tmux.until(|l| l.len() > 3 && l[3] == "> 2")?;

tmux.send_keys(&[Tab])?;
tmux.until(|l| l[2] == "> 1")?;
tmux.until(|l| l[3] == " 2")?;
tmux.until(|l| l.len() > 2 && l[2] == "> 1")?;
tmux.until(|l| l.len() > 3 && l[3] == " 2")?;

Ok(())
}
Expand All @@ -221,8 +221,8 @@ fn keys_interactive_btab() -> Result<()> {
let _ = tmux.start_sk(Some("seq 1 100000"), &["-i"]);
tmux.until(|l| l[0].starts_with("c>") && l[1].starts_with(" 100000"))?;
tmux.send_keys(&[BTab])?;
tmux.until(|l| l[2] == " 1")?;
tmux.until(|l| l[3] == "> 2")?;
tmux.until(|l| l.len() > 2 && l[2] == " 1")?;
tmux.until(|l| l.len() > 3 && l[3] == "> 2")?;

Ok(())
}
Expand Down
Loading

0 comments on commit dc6a8ea

Please sign in to comment.