diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2014-10-30 18:47:08 -0400 |
---|---|---|
committer | Cory Fields <cory-nospam-@coryfields.com> | 2014-10-31 00:04:14 -0400 |
commit | f635269cd154eb69ad67a6fb004ed360b6112e27 (patch) | |
tree | 99994c1492950212a0ca1aaa88a6f9e73df0ff17 /src/test/alert_tests.cpp | |
parent | 8d2396c9c41cbd5b8746f48f41180697f58b0681 (diff) |
tests: enable alertnotify test for Windows
The semantics of "echo" are different there and they change the resulting text,
but they're still correct and predictable.
Diffstat (limited to 'src/test/alert_tests.cpp')
-rw-r--r-- | src/test/alert_tests.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/test/alert_tests.cpp b/src/test/alert_tests.cpp index 9cf7a98f46..4869ba52ac 100644 --- a/src/test/alert_tests.cpp +++ b/src/test/alert_tests.cpp @@ -154,9 +154,6 @@ BOOST_AUTO_TEST_CASE(AlertApplies) } -// This uses sh 'echo' to test the -alertnotify function, writing to a -// /tmp file. So skip it on Windows: -#ifndef WIN32 BOOST_AUTO_TEST_CASE(AlertNotify) { SetMockTime(11); @@ -171,15 +168,24 @@ BOOST_AUTO_TEST_CASE(AlertNotify) std::vector<std::string> r = read_lines(temp); BOOST_CHECK_EQUAL(r.size(), 4u); + +// Windows built-in echo semantics are different than posixy shells. Quotes and +// whitespace are printed literally. + +#ifndef WIN32 BOOST_CHECK_EQUAL(r[0], "Alert 1"); BOOST_CHECK_EQUAL(r[1], "Alert 2, cancels 1"); BOOST_CHECK_EQUAL(r[2], "Alert 2, cancels 1"); BOOST_CHECK_EQUAL(r[3], "Evil Alert; /bin/ls; echo "); // single-quotes should be removed - +#else + BOOST_CHECK_EQUAL(r[0], "'Alert 1' "); + BOOST_CHECK_EQUAL(r[1], "'Alert 2, cancels 1' "); + BOOST_CHECK_EQUAL(r[2], "'Alert 2, cancels 1' "); + BOOST_CHECK_EQUAL(r[3], "'Evil Alert; /bin/ls; echo ' "); +#endif boost::filesystem::remove(temp); SetMockTime(0); } -#endif BOOST_AUTO_TEST_SUITE_END() |