Skip to content

Commit

Permalink
test(complete): Verify filename splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
sudotac committed Feb 2, 2024
1 parent 2cc81c6 commit fe16f24
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions clap_complete/tests/testsuite/bash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,27 @@ fn complete() {
);
}

// Issue 5313 (https://github.com/clap-rs/clap/issues/5313)
{
use std::fs::File;
use std::path::Path;

let testdir = snapbox::path::PathFixture::mutable_temp().unwrap();
let testdir_path = testdir.path().unwrap();

File::create(Path::new(testdir_path).join("foo bar.txt")).unwrap();
File::create(Path::new(testdir_path).join("baz\tqux.txt")).unwrap();

let input = format!(
"exhaustive hint --file {}/\t\t",
testdir_path.to_string_lossy()
);
let expected = r#"%
foo bar.txt baz qux.txt "#;
let actual = runtime.complete(input.as_str(), &term).unwrap();
snapbox::assert_eq(expected, actual);
}

let input = "exhaustive hint --other \t";
let expected = "exhaustive hint --other % exhaustive hint --other ";
let actual = runtime.complete(input, &term).unwrap();
Expand Down

0 comments on commit fe16f24

Please sign in to comment.