mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-05-19 09:40:22 -07:00
Add test for option-arguments with leading hyphens
This commit is contained in:
parent
6dce04963d
commit
b7c3cf314d
@ -1728,12 +1728,22 @@ fn regression_506_word_boundaries_not_parenthesized() {
|
|||||||
fn regression_568_leading_hyphen_option_arguments() {
|
fn regression_568_leading_hyphen_option_arguments() {
|
||||||
let wd = WorkDir::new("regression_568_leading_hyphen_option_arguments");
|
let wd = WorkDir::new("regression_568_leading_hyphen_option_arguments");
|
||||||
let path = "file";
|
let path = "file";
|
||||||
wd.create(path, "foo bar baz\n");
|
wd.create(path, "foo bar -baz\n");
|
||||||
|
|
||||||
|
let mut cmd = wd.command();
|
||||||
|
cmd.arg("-e-baz").arg("-e").arg("-baz").arg(path);
|
||||||
|
let lines: String = wd.stdout(&mut cmd);
|
||||||
|
assert_eq!(lines, "foo bar -baz\n");
|
||||||
|
|
||||||
|
let mut cmd = wd.command();
|
||||||
|
cmd.arg("-rni").arg("bar").arg(path);
|
||||||
|
let lines: String = wd.stdout(&mut cmd);
|
||||||
|
assert_eq!(lines, "foo ni -baz\n");
|
||||||
|
|
||||||
let mut cmd = wd.command();
|
let mut cmd = wd.command();
|
||||||
cmd.arg("-r").arg("-n").arg("-i").arg("bar").arg(path);
|
cmd.arg("-r").arg("-n").arg("-i").arg("bar").arg(path);
|
||||||
let lines: String = wd.stdout(&mut cmd);
|
let lines: String = wd.stdout(&mut cmd);
|
||||||
assert_eq!(lines, "foo -n baz\n");
|
assert_eq!(lines, "foo -n -baz\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user