aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorChristian Parpart <christian@parpart.family>2018-07-10 16:36:36 +0800
committerChristian Parpart <christian@parpart.family>2018-07-16 22:34:23 +0800
commit05121eebd1f219e9ae1cdf79afa8d0201ad7975a (patch)
tree3efe6c376ed42342cedcbd61d509310ecea98c39 /test
parent31e56f9f9976cee44f000226318dca566f0f0b79 (diff)
downloaddexon-solidity-05121eebd1f219e9ae1cdf79afa8d0201ad7975a.tar
dexon-solidity-05121eebd1f219e9ae1cdf79afa8d0201ad7975a.tar.gz
dexon-solidity-05121eebd1f219e9ae1cdf79afa8d0201ad7975a.tar.bz2
dexon-solidity-05121eebd1f219e9ae1cdf79afa8d0201ad7975a.tar.lz
dexon-solidity-05121eebd1f219e9ae1cdf79afa8d0201ad7975a.tar.xz
dexon-solidity-05121eebd1f219e9ae1cdf79afa8d0201ad7975a.tar.zst
dexon-solidity-05121eebd1f219e9ae1cdf79afa8d0201ad7975a.zip
isoltest: adds support for properly handling ANSI escape sequences on Win32/Win64 builds.
Diffstat (limited to 'test')
-rw-r--r--test/tools/isoltest.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/tools/isoltest.cpp b/test/tools/isoltest.cpp
index 41dff148..ed4f148e 100644
--- a/test/tools/isoltest.cpp
+++ b/test/tools/isoltest.cpp
@@ -29,6 +29,10 @@
#include <fstream>
#include <queue>
+#if defined(_WIN32)
+#include <windows.h>
+#endif
+
using namespace dev;
using namespace dev::solidity;
using namespace dev::solidity::test;
@@ -242,8 +246,30 @@ TestStats TestTool::processPath(
}
+void setupTerminal()
+{
+#if defined(_WIN32) && defined(ENABLE_VIRTUAL_TERMINAL_PROCESSING)
+ // Set output mode to handle virtual terminal (ANSI escape sequences)
+ // ignore any error, as this is just a "nice-to-have"
+ // only windows needs to be taken care of, as other platforms (Linux/OSX) support them natively.
+ HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
+ if (hOut == INVALID_HANDLE_VALUE)
+ return;
+
+ DWORD dwMode = 0;
+ if (!GetConsoleMode(hOut, &dwMode))
+ return;
+
+ dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
+ if (!SetConsoleMode(hOut, dwMode))
+ return;
+#endif
+}
+
int main(int argc, char *argv[])
{
+ setupTerminal();
+
if (getenv("EDITOR"))
TestTool::editor = getenv("EDITOR");
else if (fs::exists("/usr/bin/editor"))