diff options
| author | MarcoFalke <[email protected]> | 2018-05-24 09:09:33 -0400 |
|---|---|---|
| committer | MarcoFalke <[email protected]> | 2018-05-24 09:09:35 -0400 |
| commit | 536120ec39bef43cf3d5ed0d1893b5b8a0ac7a85 (patch) | |
| tree | da9ab408af6a73057bfa1aed2033e8858a123cc8 /src | |
| parent | Merge #13314: Fix FreeBSD build by including utilstrencodings.h (diff) | |
| parent | Declare TorReply parsing functions in torcontrol_tests (diff) | |
| download | discoin-536120ec39bef43cf3d5ed0d1893b5b8a0ac7a85.tar.xz discoin-536120ec39bef43cf3d5ed0d1893b5b8a0ac7a85.zip | |
Merge #13291: test: Don't include torcontrol.cpp into the test file
97c112d4ca Declare TorReply parsing functions in torcontrol_tests (Ben Woosley)
Pull request description:
These methods are standalone string parsing methods which were included
into test via an include of torcontrol.cpp, which is bad practice.
~~Splitting them out reveals that they were the only torcontrol.cpp
methods under test, so the test file is renamed tor_reply_tests.cpp.~~
Introduced in #10408
Tree-SHA512: 8ff11a9c900a88f910a73dfe16f43581a567e9d60e9298a8a963fc9dd7cffb4d97a644da677610aafb7d89f1dd1cede9afeae2c6344305e021a9a322dbcea0ac
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/torcontrol_tests.cpp | 10 | ||||
| -rw-r--r-- | src/torcontrol.cpp | 5 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/test/torcontrol_tests.cpp b/src/test/torcontrol_tests.cpp index 8bd5ce122..c7ceb2f1e 100644 --- a/src/test/torcontrol_tests.cpp +++ b/src/test/torcontrol_tests.cpp @@ -3,10 +3,18 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. // #include <test/test_bitcoin.h> -#include <torcontrol.cpp> +#include <torcontrol.h> #include <boost/test/unit_test.hpp> +#include <map> +#include <string> +#include <utility> + + +std::pair<std::string, std::string> SplitTorReplyLine(const std::string& s); +std::map<std::string, std::string> ParseTorReplyMapping(const std::string& s); + BOOST_FIXTURE_TEST_SUITE(torcontrol_tests, BasicTestingSetup) diff --git a/src/torcontrol.cpp b/src/torcontrol.cpp index 717d1cf7e..1791bfd7f 100644 --- a/src/torcontrol.cpp +++ b/src/torcontrol.cpp @@ -251,7 +251,7 @@ bool TorControlConnection::Command(const std::string &cmd, const ReplyHandlerCB& * Grammar is implicitly defined in https://spec.torproject.org/control-spec by * the server reply formats for PROTOCOLINFO (S3.21) and AUTHCHALLENGE (S3.24). */ -static std::pair<std::string,std::string> SplitTorReplyLine(const std::string &s) +std::pair<std::string,std::string> SplitTorReplyLine(const std::string &s) { size_t ptr=0; std::string type; @@ -270,7 +270,7 @@ static std::pair<std::string,std::string> SplitTorReplyLine(const std::string &s * the server reply formats for PROTOCOLINFO (S3.21), AUTHCHALLENGE (S3.24), * and ADD_ONION (S3.27). See also sections 2.1 and 2.3. */ -static std::map<std::string,std::string> ParseTorReplyMapping(const std::string &s) +std::map<std::string,std::string> ParseTorReplyMapping(const std::string &s) { std::map<std::string,std::string> mapping; size_t ptr=0; @@ -773,4 +773,3 @@ void StopTorControl() gBase = nullptr; } } - |