aboutsummaryrefslogtreecommitdiff
path: root/lldb/unittests/Utility/UriParserTest.cpp
diff options
context:
space:
mode:
authorKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
committerKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
commitb9c1b51e45b845debb76d8658edabca70ca56079 (patch)
treedfcb5a13ef2b014202340f47036da383eaee74aa /lldb/unittests/Utility/UriParserTest.cpp
parentd5aa73376966339caad04013510626ec2e42c760 (diff)
downloadllvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip
llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz
llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.bz2
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
Diffstat (limited to 'lldb/unittests/Utility/UriParserTest.cpp')
-rw-r--r--lldb/unittests/Utility/UriParserTest.cpp206
1 files changed, 91 insertions, 115 deletions
diff --git a/lldb/unittests/Utility/UriParserTest.cpp b/lldb/unittests/Utility/UriParserTest.cpp
index fe0a6a7..2fd1960 100644
--- a/lldb/unittests/Utility/UriParserTest.cpp
+++ b/lldb/unittests/Utility/UriParserTest.cpp
@@ -1,159 +1,135 @@
-#include "gtest/gtest.h"
#include "Utility/UriParser.h"
+#include "gtest/gtest.h"
-namespace
-{
- class UriParserTest: public ::testing::Test
- {
- };
+namespace {
+class UriParserTest : public ::testing::Test {};
}
// result strings (scheme/hostname/port/path) passed into UriParser::Parse
-// are initialized to kAsdf so we can verify that they are unmodified if the
+// are initialized to kAsdf so we can verify that they are unmodified if the
// URI is invalid
-static const char* kAsdf = "asdf";
+static const char *kAsdf = "asdf";
-class UriTestCase
-{
+class UriTestCase {
public:
- UriTestCase(const char* uri, const char* scheme, const char* hostname, int port, const char* path) :
- m_uri(uri),
- m_result(true),
- m_scheme(scheme),
- m_hostname(hostname),
- m_port(port),
- m_path(path)
- {
- }
-
- UriTestCase(const char* uri) :
- m_uri(uri),
- m_result(false),
- m_scheme(kAsdf),
- m_hostname(kAsdf),
- m_port(1138),
- m_path(kAsdf)
- {
- }
-
- const char* m_uri;
- bool m_result;
- const char* m_scheme;
- const char* m_hostname;
- int m_port;
- const char* m_path;
+ UriTestCase(const char *uri, const char *scheme, const char *hostname,
+ int port, const char *path)
+ : m_uri(uri), m_result(true), m_scheme(scheme), m_hostname(hostname),
+ m_port(port), m_path(path) {}
+
+ UriTestCase(const char *uri)
+ : m_uri(uri), m_result(false), m_scheme(kAsdf), m_hostname(kAsdf),
+ m_port(1138), m_path(kAsdf) {}
+
+ const char *m_uri;
+ bool m_result;
+ const char *m_scheme;
+ const char *m_hostname;
+ int m_port;
+ const char *m_path;
};
-#define VALIDATE \
- std::string scheme(kAsdf); \
- std::string hostname(kAsdf); \
- int port(1138); \
- std::string path(kAsdf); \
- EXPECT_EQ (testCase.m_result, UriParser::Parse(testCase.m_uri, scheme, hostname, port, path)); \
- EXPECT_STREQ (testCase.m_scheme, scheme.c_str()); \
- EXPECT_STREQ (testCase.m_hostname, hostname.c_str()); \
- EXPECT_EQ (testCase.m_port, port); \
- EXPECT_STREQ (testCase.m_path, path.c_str());
+#define VALIDATE \
+ std::string scheme(kAsdf); \
+ std::string hostname(kAsdf); \
+ int port(1138); \
+ std::string path(kAsdf); \
+ EXPECT_EQ(testCase.m_result, \
+ UriParser::Parse(testCase.m_uri, scheme, hostname, port, path)); \
+ EXPECT_STREQ(testCase.m_scheme, scheme.c_str()); \
+ EXPECT_STREQ(testCase.m_hostname, hostname.c_str()); \
+ EXPECT_EQ(testCase.m_port, port); \
+ EXPECT_STREQ(testCase.m_path, path.c_str());
-TEST_F (UriParserTest, Minimal)
-{
- const UriTestCase testCase("x://y", "x", "y", -1, "/");
- VALIDATE
+TEST_F(UriParserTest, Minimal) {
+ const UriTestCase testCase("x://y", "x", "y", -1, "/");
+ VALIDATE
}
-TEST_F (UriParserTest, MinimalPort)
-{
- const UriTestCase testCase("x://y:1", "x", "y", 1, "/");
- VALIDATE
+TEST_F(UriParserTest, MinimalPort) {
+ const UriTestCase testCase("x://y:1", "x", "y", 1, "/");
+ VALIDATE
}
-TEST_F (UriParserTest, MinimalPath)
-{
- const UriTestCase testCase("x://y/", "x", "y", -1, "/");
- VALIDATE
+TEST_F(UriParserTest, MinimalPath) {
+ const UriTestCase testCase("x://y/", "x", "y", -1, "/");
+ VALIDATE
}
-TEST_F (UriParserTest, MinimalPortPath)
-{
- const UriTestCase testCase("x://y:1/", "x", "y", 1, "/");
- VALIDATE
+TEST_F(UriParserTest, MinimalPortPath) {
+ const UriTestCase testCase("x://y:1/", "x", "y", 1, "/");
+ VALIDATE
}
-TEST_F (UriParserTest, LongPath)
-{
- const UriTestCase testCase("x://y/abc/def/xyz", "x", "y", -1, "/abc/def/xyz");
- VALIDATE
+TEST_F(UriParserTest, LongPath) {
+ const UriTestCase testCase("x://y/abc/def/xyz", "x", "y", -1, "/abc/def/xyz");
+ VALIDATE
}
-TEST_F (UriParserTest, TypicalPortPath)
-{
- const UriTestCase testCase("connect://192.168.100.132:5432/", "connect", "192.168.100.132", 5432, "/");
- VALIDATE
+TEST_F(UriParserTest, TypicalPortPath) {
+ const UriTestCase testCase("connect://192.168.100.132:5432/", "connect",
+ "192.168.100.132", 5432, "/");
+ VALIDATE
}
-TEST_F (UriParserTest, BracketedHostnamePort)
-{
- const UriTestCase testCase("connect://[192.168.100.132]:5432/", "connect", "192.168.100.132", 5432, "/");
- VALIDATE
+TEST_F(UriParserTest, BracketedHostnamePort) {
+ const UriTestCase testCase("connect://[192.168.100.132]:5432/", "connect",
+ "192.168.100.132", 5432, "/");
+ VALIDATE
}
-TEST_F (UriParserTest, BracketedHostname)
-{
- const UriTestCase testCase("connect://[192.168.100.132]", "connect", "192.168.100.132", -1, "/");
- VALIDATE
+TEST_F(UriParserTest, BracketedHostname) {
+ const UriTestCase testCase("connect://[192.168.100.132]", "connect",
+ "192.168.100.132", -1, "/");
+ VALIDATE
}
-TEST_F (UriParserTest, BracketedHostnameWithColon)
-{
- const UriTestCase testCase("connect://[192.168.100.132:5555]:1234", "connect", "192.168.100.132:5555", 1234, "/");
- VALIDATE
+TEST_F(UriParserTest, BracketedHostnameWithColon) {
+ const UriTestCase testCase("connect://[192.168.100.132:5555]:1234", "connect",
+ "192.168.100.132:5555", 1234, "/");
+ VALIDATE
}
-TEST_F (UriParserTest, SchemeHostSeparator)
-{
- const UriTestCase testCase("x:/y");
- VALIDATE
+TEST_F(UriParserTest, SchemeHostSeparator) {
+ const UriTestCase testCase("x:/y");
+ VALIDATE
}
-TEST_F (UriParserTest, SchemeHostSeparator2)
-{
- const UriTestCase testCase("x:y");
- VALIDATE
+TEST_F(UriParserTest, SchemeHostSeparator2) {
+ const UriTestCase testCase("x:y");
+ VALIDATE
}
-TEST_F (UriParserTest, SchemeHostSeparator3)
-{
- const UriTestCase testCase("x//y");
- VALIDATE
+TEST_F(UriParserTest, SchemeHostSeparator3) {
+ const UriTestCase testCase("x//y");
+ VALIDATE
}
-TEST_F (UriParserTest, SchemeHostSeparator4)
-{
- const UriTestCase testCase("x/y");
- VALIDATE
+TEST_F(UriParserTest, SchemeHostSeparator4) {
+ const UriTestCase testCase("x/y");
+ VALIDATE
}
-TEST_F (UriParserTest, BadPort)
-{
- const UriTestCase testCase("x://y:a/");
- VALIDATE
+TEST_F(UriParserTest, BadPort) {
+ const UriTestCase testCase("x://y:a/");
+ VALIDATE
}
-TEST_F (UriParserTest, BadPort2)
-{
- const UriTestCase testCase("x://y:5432a/");
- VALIDATE
+TEST_F(UriParserTest, BadPort2) {
+ const UriTestCase testCase("x://y:5432a/");
+ VALIDATE
}
-TEST_F (UriParserTest, Empty)
-{
- const UriTestCase testCase("");
- VALIDATE
+TEST_F(UriParserTest, Empty) {
+ const UriTestCase testCase("");
+ VALIDATE
}
-TEST_F (UriParserTest, PortOverflow)
-{
- const UriTestCase testCase("x://y:0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/");
- VALIDATE
+TEST_F(UriParserTest, PortOverflow) {
+ const UriTestCase testCase("x://"
+ "y:"
+ "0123456789012345678901234567890123456789012345678"
+ "9012345678901234567890123456789012345678901234567"
+ "89/");
+ VALIDATE
}
-