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.
This commit is contained in:
parent
8d2396c9c4
commit
f635269cd1
1 changed files with 11 additions and 5 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue