diff options
author | Daniel Kirchner <daniel@ekpyron.org> | 2018-08-04 01:30:18 +0800 |
---|---|---|
committer | Daniel Kirchner <daniel@ekpyron.org> | 2018-08-04 02:35:50 +0800 |
commit | d923926ff7ceaad551fe76afb356266e28a2a1ea (patch) | |
tree | d29538c748e463ad4f93441fa5b77f870530a5d6 /test/tools/isoltest.cpp | |
parent | 0b20e4fd22349da691056f3a4ac89c7c5006a0c4 (diff) | |
download | dexon-solidity-d923926ff7ceaad551fe76afb356266e28a2a1ea.tar dexon-solidity-d923926ff7ceaad551fe76afb356266e28a2a1ea.tar.gz dexon-solidity-d923926ff7ceaad551fe76afb356266e28a2a1ea.tar.bz2 dexon-solidity-d923926ff7ceaad551fe76afb356266e28a2a1ea.tar.lz dexon-solidity-d923926ff7ceaad551fe76afb356266e28a2a1ea.tar.xz dexon-solidity-d923926ff7ceaad551fe76afb356266e28a2a1ea.tar.zst dexon-solidity-d923926ff7ceaad551fe76afb356266e28a2a1ea.zip |
Infrastructure for extracting JSON AST tests.
Diffstat (limited to 'test/tools/isoltest.cpp')
-rw-r--r-- | test/tools/isoltest.cpp | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/test/tools/isoltest.cpp b/test/tools/isoltest.cpp index bd4b0db9..7d15b07a 100644 --- a/test/tools/isoltest.cpp +++ b/test/tools/isoltest.cpp @@ -18,6 +18,7 @@ #include <libdevcore/CommonIO.h> #include <test/libsolidity/AnalysisFramework.h> #include <test/libsolidity/SyntaxTest.h> +#include <test/libsolidity/ASTJSONTest.h> #include <boost/algorithm/string.hpp> #include <boost/algorithm/string/replace.hpp> @@ -336,22 +337,53 @@ Allowed options)", } } + TestStats global_stats { 0, 0 }; + fs::path syntaxTestPath = testPath / "libsolidity" / "syntaxTests"; if (fs::exists(syntaxTestPath) && fs::is_directory(syntaxTestPath)) { auto stats = TestTool::processPath(SyntaxTest::create, testPath / "libsolidity", "syntaxTests", formatted); - cout << endl << "Summary: "; + cout << endl << "Syntax Test Summary: "; FormattedScope(cout, formatted, {BOLD, stats ? GREEN : RED}) << stats.successCount << "/" << stats.runCount; - cout << " tests successful." << endl; + cout << " tests successful." << endl << endl; - return stats ? 0 : 1; + global_stats.runCount += stats.runCount; + global_stats.successCount += stats.successCount; } else { cerr << "Syntax tests not found. Use the --testpath argument." << endl; return 1; } + + fs::path astJsonTestPath = testPath / "libsolidity" / "ASTJSON"; + + if (fs::exists(astJsonTestPath) && fs::is_directory(astJsonTestPath)) + { + auto stats = TestTool::processPath(ASTJSONTest::create, testPath / "libsolidity", "ASTJSON", formatted); + + cout << endl << "JSON AST Test Summary: "; + FormattedScope(cout, formatted, {BOLD, stats ? GREEN : RED}) << + stats.successCount << "/" << stats.runCount; + cout << " tests successful." << endl << endl; + + global_stats.runCount += stats.runCount; + global_stats.successCount += stats.successCount; + } + else + { + cerr << "JSON AST tests not found." << endl; + return 1; + } + + cout << endl << "Summary: "; + FormattedScope(cout, formatted, {BOLD, global_stats ? GREEN : RED}) << + global_stats.successCount << "/" << global_stats.runCount; + cout << " tests successful." << endl; + + + return global_stats ? 0 : 1; } |