aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-03-16 20:39:01 +0800
committerGitHub <noreply@github.com>2018-03-16 20:39:01 +0800
commit2b2527f31ce3e7946b35759a1ac4a096c918b91c (patch)
treecdbef7c43a020d40e46821a92fb99804365ff5e5
parent9e1095608d265ac941afbf1e4ed4c79d63a15926 (diff)
parente68c19c47b03eebb9af528bf2b03bb0086484c63 (diff)
downloaddexon-solidity-2b2527f31ce3e7946b35759a1ac4a096c918b91c.tar.gz
dexon-solidity-2b2527f31ce3e7946b35759a1ac4a096c918b91c.tar.zst
dexon-solidity-2b2527f31ce3e7946b35759a1ac4a096c918b91c.zip
Merge pull request #3751 from ethereum/syntaxTestsExtensions
Only consider files ending with .sol and not starting with ~ in synta…
-rw-r--r--test/libsolidity/SyntaxTest.cpp10
-rw-r--r--test/libsolidity/SyntaxTest.h1
-rw-r--r--test/tools/isoltest.cpp4
3 files changed, 13 insertions, 2 deletions
diff --git a/test/libsolidity/SyntaxTest.cpp b/test/libsolidity/SyntaxTest.cpp
index acfdff29..ca051138 100644
--- a/test/libsolidity/SyntaxTest.cpp
+++ b/test/libsolidity/SyntaxTest.cpp
@@ -205,6 +205,13 @@ test_case *make_test_case(
}
#endif
+bool SyntaxTest::isTestFilename(boost::filesystem::path const& _filename)
+{
+ return _filename.extension().string() == ".sol" &&
+ !boost::starts_with(_filename.string(), "~") &&
+ !boost::starts_with(_filename.string(), ".");
+}
+
int SyntaxTest::registerTests(
boost::unit_test::test_suite& _suite,
boost::filesystem::path const& _basepath,
@@ -220,7 +227,8 @@ int SyntaxTest::registerTests(
fs::directory_iterator(fullpath),
fs::directory_iterator()
))
- numTestsAdded += registerTests(*sub_suite, _basepath, _path / entry.path().filename());
+ if (fs::is_directory(entry.path()) || isTestFilename(entry.path().filename()))
+ numTestsAdded += registerTests(*sub_suite, _basepath, _path / entry.path().filename());
_suite.add(sub_suite);
}
else
diff --git a/test/libsolidity/SyntaxTest.h b/test/libsolidity/SyntaxTest.h
index 441cc4f8..cb6ee05c 100644
--- a/test/libsolidity/SyntaxTest.h
+++ b/test/libsolidity/SyntaxTest.h
@@ -71,6 +71,7 @@ public:
boost::filesystem::path const& _basepath,
boost::filesystem::path const& _path
);
+ static bool isTestFilename(boost::filesystem::path const& _filename);
private:
bool matchesExpectations(ErrorList const& _errors) const;
static std::string errorMessage(Error const& _e);
diff --git a/test/tools/isoltest.cpp b/test/tools/isoltest.cpp
index 668481cf..5ad3bfb5 100644
--- a/test/tools/isoltest.cpp
+++ b/test/tools/isoltest.cpp
@@ -19,6 +19,7 @@
#include <test/libsolidity/AnalysisFramework.h>
#include <test/libsolidity/SyntaxTest.h>
+#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/filesystem.hpp>
#include <boost/program_options.hpp>
@@ -218,7 +219,8 @@ SyntaxTestStats SyntaxTestTool::processPath(
fs::directory_iterator(fullpath),
fs::directory_iterator()
))
- paths.push(currentPath / entry.path().filename());
+ if (fs::is_directory(entry.path()) || SyntaxTest::isTestFilename(entry.path().filename()))
+ paths.push(currentPath / entry.path().filename());
}
else
{