summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2018-04-23 20:37:59 -0400
committerAndrew Gallant <jamslam@gmail.com>2018-04-23 20:37:59 -0400
commitbf51058eb27458c4f01d4cbf8bf4ee0d80fac61e (patch)
treeaaf80ef59fd06d2510005829a3882874e2c36e8e /tests
parent3dc6fe6f057028398f19cfdcc2f3d059fda1838b (diff)
tests: fix tests on Windows
A bug in the atty crate was previously masking a problem with the integration tests on Windows. Namely, the bug in atty resulted in atty::is(Stdin) returning true if we couldn't get the file name for the stdin stream. This in turn caused tests like `rg foo` to search the CWD, which was the intended behavior. However, once the atty bug was fixed, atty::is(Stdin) no longer returned true, causing `rg foo` searches to fail. On Unix-like systems, the atty behavior has always been correct. However, on Unix-like systems we have a decent way of detecting whether stdin is readable or not. If it isn't---which is the case in the integration tests---then we fall back to searching the CWD. On Windows however, we haven't yet implemented anything to detect whether stdin is readable or not, so we must always assume that it is. Therefore, we never get the "go ahead" to search the CWD and the tests fail. Most of the tests are written to search the CWD explicitly, but there were a few stragglers that don't. This isn't great, and we should try to figure out how to do better stdin detection on Windows.
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/tests.rs b/tests/tests.rs
index b1b972cf..0ee4995b 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -1866,6 +1866,7 @@ fn feature_411_parallel_search_stats() {
let mut cmd = wd.command();
cmd.arg("--stats");
cmd.arg("Sherlock");
+ cmd.arg("./");
let lines: String = wd.stdout(&mut cmd);
assert_eq!(lines.contains("4 matched lines"), true);
@@ -2021,7 +2022,7 @@ fn regression_270() {
wd.create("foo", "-test");
let mut cmd = wd.command();
- cmd.arg("-e").arg("-test");
+ cmd.arg("-e").arg("-test").arg("./");
let lines: String = wd.stdout(&mut cmd);
assert_eq!(lines, path("foo:-test\n"));
}
@@ -2170,7 +2171,7 @@ fn regression_693_context_option_in_contextless_mode() {
wd.create("bar", "xyz\n");
let mut cmd = wd.command();
- cmd.arg("-C1").arg("-c").arg("--sort-files").arg("xyz");
+ cmd.arg("-C1").arg("-c").arg("--sort-files").arg("xyz").arg("./");
let lines: String = wd.stdout(&mut cmd);
let expected = "\