Merge pull request #6068 from ethereum/fix-no-color

Fix isoltest --no-color option
This commit is contained in:
chriseth 2019-02-21 17:08:10 +01:00 committed by GitHub
commit 6a1e339b9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -52,7 +52,7 @@ IsolTestOptions::IsolTestOptions(std::string* _editor):
{ {
options.add_options() options.add_options()
("help", po::bool_switch(&showHelp), "Show this help screen.") ("help", po::bool_switch(&showHelp), "Show this help screen.")
("no-color", po::bool_switch(&formatted), "don't use colors") ("no-color", po::bool_switch(&noColor), "don't use colors")
("editor", po::value<std::string>(_editor)->default_value(editorPath()), "editor for opening test files"); ("editor", po::value<std::string>(_editor)->default_value(editorPath()), "editor for opening test files");
} }

View File

@ -28,7 +28,7 @@ namespace test
struct IsolTestOptions: CommonOptions struct IsolTestOptions: CommonOptions
{ {
bool formatted = true; bool noColor = false;
bool showHelp = false; bool showHelp = false;
IsolTestOptions(std::string* _editor); IsolTestOptions(std::string* _editor);

View File

@ -354,14 +354,14 @@ int main(int argc, char const *argv[])
if (ts.smt && options.disableSMT) if (ts.smt && options.disableSMT)
continue; continue;
if (auto stats = runTestSuite(ts.title, options.testPath / ts.path, ts.subpath, options.ipcPath.string(), ts.testCaseCreator, options.formatted)) if (auto stats = runTestSuite(ts.title, options.testPath / ts.path, ts.subpath, options.ipcPath.string(), ts.testCaseCreator, !options.noColor))
global_stats += *stats; global_stats += *stats;
else else
return 1; return 1;
} }
cout << endl << "Summary: "; cout << endl << "Summary: ";
AnsiColorized(cout, options.formatted, {BOLD, global_stats ? GREEN : RED}) << AnsiColorized(cout, !options.noColor, {BOLD, global_stats ? GREEN : RED}) <<
global_stats.successCount << "/" << global_stats.testCount; global_stats.successCount << "/" << global_stats.testCount;
cout << " tests successful." << endl; cout << " tests successful." << endl;