diff options
author | dana <dana@dana.is> | 2017-07-29 10:58:04 -0500 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2017-07-30 17:55:24 -0400 |
commit | b7c3cf314d31cec85f9e3e61edf385c9c2f4e7b5 (patch) | |
tree | b026f3b84b42c6664ecb3ccd832ac6c0f34c4158 /tests | |
parent | 6dce04963d4ee2d1bd6c17559d237f6dc88e048e (diff) |
Add test for option-arguments with leading hyphens
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tests.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/tests.rs b/tests/tests.rs index 86fab015..ddc4d196 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -1728,12 +1728,22 @@ fn regression_506_word_boundaries_not_parenthesized() { fn regression_568_leading_hyphen_option_arguments() { let wd = WorkDir::new("regression_568_leading_hyphen_option_arguments"); 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(); cmd.arg("-r").arg("-n").arg("-i").arg("bar").arg(path); let lines: String = wd.stdout(&mut cmd); - assert_eq!(lines, "foo -n baz\n"); + assert_eq!(lines, "foo -n -baz\n"); } #[test] |