diff options
author | Andrew Gallant <jamslam@gmail.com> | 2016-09-20 20:24:03 -0400 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2016-09-20 20:24:03 -0400 |
commit | 7402db7b43191c84b47c532b24c831e64b4c212c (patch) | |
tree | b368ca0c4fec4d6c3109667fe39b460ce70997f1 /tests | |
parent | 7698b602569d685354244364e8f4954cd772181c (diff) |
Add "unrestricted" flag.
I don't like having multiple flags do the same thing, but -u, -uu and -uuu
are much easier to remember, particularly with -uuu meaning "search
everything."
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tests.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/tests.rs b/tests/tests.rs index daff20da..d08dc6ae 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -525,6 +525,39 @@ baz/sherlock:be, to a very large extent, the result of luck. Sherlock Holmes } }); +sherlock!(unrestricted1, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| { + wd.create(".gitignore", "sherlock\n"); + cmd.arg("-u"); + + let lines: String = wd.stdout(&mut cmd); + let expected = "\ +sherlock:For the Doctor Watsons of this world, as opposed to the Sherlock +sherlock:be, to a very large extent, the result of luck. Sherlock Holmes +"; + assert_eq!(lines, expected); +}); + +sherlock!(unrestricted2, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| { + wd.remove("sherlock"); + wd.create(".sherlock", hay::SHERLOCK); + cmd.arg("-uu"); + + let lines: String = wd.stdout(&mut cmd); + let expected = "\ +.sherlock:For the Doctor Watsons of this world, as opposed to the Sherlock +.sherlock:be, to a very large extent, the result of luck. Sherlock Holmes +"; + assert_eq!(lines, expected); +}); + +sherlock!(unrestricted3, "foo", ".", |wd: WorkDir, mut cmd: Command| { + wd.create("file", "foo\x00bar\nfoo\x00baz\n"); + cmd.arg("-uuu"); + + let lines: String = wd.stdout(&mut cmd); + assert_eq!(lines, "file:foo\nfile:foo\n"); +}); + #[test] fn binary_nosearch() { let wd = WorkDir::new("binary_nosearch"); |