Skip to content

Commit 536120e

Browse files
author
MarcoFalke
committed
Merge #13291: test: Don't include torcontrol.cpp into the test file
97c112d 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
2 parents a9b6957 + 97c112d commit 536120e

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/test/torcontrol_tests.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,18 @@
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44
//
55
#include <test/test_bitcoin.h>
6-
#include <torcontrol.cpp>
6+
#include <torcontrol.h>
77

88
#include <boost/test/unit_test.hpp>
99

10+
#include <map>
11+
#include <string>
12+
#include <utility>
13+
14+
15+
std::pair<std::string, std::string> SplitTorReplyLine(const std::string& s);
16+
std::map<std::string, std::string> ParseTorReplyMapping(const std::string& s);
17+
1018

1119
BOOST_FIXTURE_TEST_SUITE(torcontrol_tests, BasicTestingSetup)
1220

src/torcontrol.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ bool TorControlConnection::Command(const std::string &cmd, const ReplyHandlerCB&
251251
* Grammar is implicitly defined in https://spec.torproject.org/control-spec by
252252
* the server reply formats for PROTOCOLINFO (S3.21) and AUTHCHALLENGE (S3.24).
253253
*/
254-
static std::pair<std::string,std::string> SplitTorReplyLine(const std::string &s)
254+
std::pair<std::string,std::string> SplitTorReplyLine(const std::string &s)
255255
{
256256
size_t ptr=0;
257257
std::string type;
@@ -270,7 +270,7 @@ static std::pair<std::string,std::string> SplitTorReplyLine(const std::string &s
270270
* the server reply formats for PROTOCOLINFO (S3.21), AUTHCHALLENGE (S3.24),
271271
* and ADD_ONION (S3.27). See also sections 2.1 and 2.3.
272272
*/
273-
static std::map<std::string,std::string> ParseTorReplyMapping(const std::string &s)
273+
std::map<std::string,std::string> ParseTorReplyMapping(const std::string &s)
274274
{
275275
std::map<std::string,std::string> mapping;
276276
size_t ptr=0;
@@ -773,4 +773,3 @@ void StopTorControl()
773773
gBase = nullptr;
774774
}
775775
}
776-

0 commit comments

Comments
 (0)