summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEvgeny Kulikov <evgeny@unity3d.com>2017-09-01 20:13:44 +0300
committerAndrew Gallant <jamslam@gmail.com>2017-10-20 20:58:27 -0400
commitf887bc1f8673fea9969adae6e70b68e3761ba171 (patch)
treee01d4d6f917dd0959a295f53442208bec7d166d9 /tests
parent363a4fa9b733c02b47c63f37c85244f2352fe260 (diff)
printer: --only-matching works with --replace
When -o/--only-matching is used with -r/--replace, the replacement works as expected. This is not a breaking change because the flags were previously set to conflict.
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/tests.rs b/tests/tests.rs
index 4de13216..0c9446c1 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -266,6 +266,20 @@ but Watson, Doctor has to have it taken out for him and dusted,
assert_eq!(lines, expected);
});
+sherlock!(replace_with_only_matching, "of (\\w+)",
+|wd: WorkDir, mut cmd: Command| {
+ cmd.arg("-o").arg("-r").arg("$1");
+ let lines: String = wd.stdout(&mut cmd);
+ let expected = "\
+this
+detective
+luck
+straw
+cigar
+";
+ assert_eq!(lines, expected);
+});
+
sherlock!(file_types, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| {
wd.create("file.py", "Sherlock");
wd.create("file.rs", "Sherlock");