Skip to content

Commit db5f1f7

Browse files
committed
Remove unnecessary namespace prefixes, some aliases and unused imports from a few test casees
1 parent ce8ca0a commit db5f1f7

20 files changed

+84
-86
lines changed

libevmasm/Assembly.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
#include <range/v3/view/enumerate.hpp>
4444
#include <range/v3/view/map.hpp>
4545

46-
#include <fstream>
4746
#include <limits>
4847
#include <iterator>
48+
#include <ostream>
4949
#include <stack>
5050

5151
using namespace solidity;

test/Common.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ void CommonOptions::addOptions()
113113
("evm-version", po::value(&evmVersionString), "which EVM version to use")
114114
// "eof-version" is declared as uint64_t, since uint8_t will be parsed as character by boost.
115115
("eof-version", po::value<uint64_t>()->implicit_value(1u), "which EOF version to use")
116-
("testpath", po::value<fs::path>(&this->testPath)->default_value(solidity::test::testPath()), "path to test files")
116+
("testpath", po::value<fs::path>(&this->testPath)->default_value(test::testPath()), "path to test files")
117117
("vm", po::value<std::vector<fs::path>>(&vmPaths), "path to evmc library, can be supplied multiple times.")
118118
("batches", po::value<size_t>(&this->batches)->default_value(1), "set number of batches to split the tests into")
119119
("selected-batch", po::value<size_t>(&this->selectedBatch)->default_value(0), "zero-based number of batch to execute")
@@ -309,7 +309,7 @@ bool isValidSemanticTestPath(boost::filesystem::path const& _testPath)
309309
boost::unit_test::precondition::predicate_t nonEOF()
310310
{
311311
return [](boost::unit_test::test_unit_id) {
312-
return !solidity::test::CommonOptions::get().eofVersion().has_value();
312+
return !CommonOptions::get().eofVersion().has_value();
313313
};
314314
}
315315

@@ -325,13 +325,13 @@ bool loadVMs(CommonOptions const& _options)
325325
if (_options.disableSemanticTests)
326326
return true;
327327

328-
bool evmSupported = solidity::test::EVMHost::checkVmPaths(_options.vmPaths);
328+
bool evmSupported = EVMHost::checkVmPaths(_options.vmPaths);
329329
if (!_options.disableSemanticTests && !evmSupported)
330330
{
331-
std::cerr << "Unable to find " << solidity::test::evmoneFilename;
331+
std::cerr << "Unable to find " << evmoneFilename;
332332
std::cerr << ". Please disable semantics tests with --no-semantic-tests or provide a path using --vm <path>." << std::endl;
333333
std::cerr << "You can download it at" << std::endl;
334-
std::cerr << solidity::test::evmoneDownloadLink << std::endl;
334+
std::cerr << evmoneDownloadLink << std::endl;
335335
return false;
336336
}
337337
return true;

test/CommonSyntaxTest.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
#include <boost/test/unit_test.hpp>
3131
#include <boost/throw_exception.hpp>
3232

33-
#include <fstream>
34-
#include <memory>
33+
#include <istream>
34+
#include <ostream>
3535
#include <stdexcept>
3636

3737
using namespace solidity;
@@ -42,7 +42,6 @@ using namespace solidity::frontend;
4242
using namespace solidity::frontend::test;
4343
using namespace solidity::test;
4444
using namespace boost::unit_test;
45-
namespace fs = boost::filesystem;
4645

4746
namespace
4847
{

test/CommonSyntaxTest.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include <iosfwd>
2828
#include <string>
2929
#include <vector>
30-
#include <utility>
3130

3231
namespace solidity::test
3332
{

test/ExecutionFramework.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
#include <libsolutil/FunctionSelector.h>
3535
#include <libsolutil/ErrorCodes.h>
3636

37-
#include <functional>
38-
3937
#include <boost/rational.hpp>
4038
#include <boost/test/unit_test.hpp>
4139

test/InteractiveTests.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,18 @@
1919
#pragma once
2020

2121
#include <test/TestCase.h>
22+
2223
#include <test/libsolidity/ABIJsonTest.h>
2324
#include <test/libsolidity/ASTJSONTest.h>
2425
#include <test/libsolidity/ASTPropertyTest.h>
25-
#include <libsolidity/FunctionDependencyGraphTest.h>
2626
#include <test/libsolidity/GasTest.h>
2727
#include <test/libsolidity/MemoryGuardTest.h>
2828
#include <test/libsolidity/NatspecJSONTest.h>
2929
#include <test/libsolidity/OptimizedIRCachingTest.h>
3030
#include <test/libsolidity/SyntaxTest.h>
3131
#include <test/libsolidity/SemanticTest.h>
3232
#include <test/libsolidity/SMTCheckerTest.h>
33+
3334
#include <test/libyul/ControlFlowGraphTest.h>
3435
#include <test/libyul/SSAControlFlowGraphTest.h>
3536
#include <test/libyul/EVMCodeTransformTest.h>
@@ -44,6 +45,8 @@
4445

4546
#include <test/libevmasm/EVMAssemblyTest.h>
4647

48+
#include <libsolidity/FunctionDependencyGraphTest.h>
49+
4750
#include <boost/filesystem.hpp>
4851

4952
namespace solidity::frontend::test

test/TestCase.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ using namespace solidity;
3131
using namespace solidity::frontend;
3232
using namespace solidity::frontend::test;
3333
using namespace solidity::util;
34+
using namespace solidity::test;
3435

3536
void TestCase::printSettings(std::ostream& _stream, const std::string& _linePrefix, const bool)
3637
{
@@ -123,7 +124,7 @@ void EVMVersionRestrictedTestCase::processEVMVersionSetting()
123124
if (!version)
124125
BOOST_THROW_EXCEPTION(std::runtime_error{"Invalid EVM version: \"" + versionString + "\""});
125126

126-
langutil::EVMVersion evmVersion = solidity::test::CommonOptions::get().evmVersion();
127+
langutil::EVMVersion evmVersion = CommonOptions::get().evmVersion();
127128
bool comparisonResult;
128129
if (comparator == ">")
129130
comparisonResult = evmVersion > version;
@@ -146,9 +147,9 @@ void EVMVersionRestrictedTestCase::processEVMVersionSetting()
146147

147148
void EVMVersionRestrictedTestCase::processBytecodeFormatSetting()
148149
{
149-
std::optional<uint8_t> eofVersion = solidity::test::CommonOptions::get().eofVersion();
150+
std::optional<uint8_t> eofVersion = CommonOptions::get().eofVersion();
150151
// EOF only available since Osaka
151-
solAssert(!eofVersion.has_value() || solidity::test::CommonOptions::get().evmVersion().supportsEOF());
152+
solAssert(!eofVersion.has_value() || CommonOptions::get().evmVersion().supportsEOF());
152153

153154
std::string bytecodeFormatString = m_reader.stringSetting("bytecodeFormat", "legacy,>=EOFv1");
154155
if (bytecodeFormatString == "legacy,>=EOFv1" || bytecodeFormatString == ">=EOFv1,legacy")

test/libevmasm/Optimiser.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include <range/v3/algorithm/any_of.hpp>
3737

3838
#include <string>
39-
#include <tuple>
4039
#include <memory>
4140

4241
using namespace solidity::langutil;

test/libsolidity/ABIJsonTest.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@
2626
#include <libsolutil/JSON.h>
2727
#include <libsolutil/AnsiColorized.h>
2828

29-
#include <fstream>
29+
#include <ostream>
30+
#include <string>
3031

3132
using namespace solidity;
3233
using namespace solidity::util;
3334
using namespace solidity::frontend;
3435
using namespace solidity::frontend::test;
36+
using namespace solidity::test;
3537

3638
ABIJsonTest::ABIJsonTest(std::string const& _filename):
3739
TestCase(_filename)
@@ -48,8 +50,8 @@ TestCase::TestResult ABIJsonTest::run(std::ostream& _stream, std::string const&
4850
"",
4951
"pragma solidity >=0.0;\n// SPDX-License-Identifier: GPL-3.0\n" + m_source
5052
}});
51-
compiler.setEVMVersion(solidity::test::CommonOptions::get().evmVersion());
52-
compiler.setOptimiserSettings(solidity::test::CommonOptions::get().optimize);
53+
compiler.setEVMVersion(CommonOptions::get().evmVersion());
54+
compiler.setOptimiserSettings(CommonOptions::get().optimize);
5355
if (!compiler.parseAndAnalyze())
5456
BOOST_THROW_EXCEPTION(std::runtime_error("Parsing contract failed"));
5557

test/libsolidity/ASTJSONTest.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,15 @@
3333
#include <boost/throw_exception.hpp>
3434

3535
#include <fstream>
36-
#include <memory>
3736
#include <stdexcept>
3837

3938
using namespace solidity;
4039
using namespace solidity::langutil;
4140
using namespace solidity::frontend;
4241
using namespace solidity::frontend::test;
42+
using namespace solidity::test;
4343
using namespace solidity::util::formatting;
4444
using namespace solidity::util;
45-
namespace fs = boost::filesystem;
4645
using namespace boost::unit_test;
4746
using namespace std::string_literals;
4847

@@ -79,7 +78,7 @@ void replaceVersionWithTag(std::string& _input)
7978
{
8079
boost::algorithm::replace_all(
8180
_input,
82-
"\"" + solidity::test::CommonOptions::get().evmVersion().name() + "\"",
81+
"\"" + CommonOptions::get().evmVersion().name() + "\"",
8382
"%EVMVERSION%"
8483
);
8584
}
@@ -89,7 +88,7 @@ void replaceTagWithVersion(std::string& _input)
8988
boost::algorithm::replace_all(
9089
_input,
9190
"%EVMVERSION%",
92-
"\"" + solidity::test::CommonOptions::get().evmVersion().name() + "\""
91+
"\"" + CommonOptions::get().evmVersion().name() + "\""
9392
);
9493
}
9594

@@ -210,7 +209,7 @@ TestCase::TestResult ASTJSONTest::run(std::ostream& _stream, std::string const&
210209
{
211210
c.reset();
212211
c.setSources(sources);
213-
c.setEVMVersion(solidity::test::CommonOptions::get().evmVersion());
212+
c.setEVMVersion(CommonOptions::get().evmVersion());
214213

215214
if (!c.parseAndAnalyze(variant.stopAfter))
216215
{

0 commit comments

Comments
 (0)