Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1010)

Unified Diff: net/ftp/ftp_util_unittest.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/ftp/ftp_util_unittest.cc
diff --git a/net/ftp/ftp_util_unittest.cc b/net/ftp/ftp_util_unittest.cc
index 5851e88a6ef582310192c07663c9122f7c1704f4..7c88d0c6be4a0294e4cb3c0a58b69e025509711c 100644
--- a/net/ftp/ftp_util_unittest.cc
+++ b/net/ftp/ftp_util_unittest.cc
@@ -22,18 +22,18 @@ TEST(FtpUtilTest, UnixFilePathToVMS) {
const char* input;
const char* expected_output;
} kTestCases[] = {
- { "", "" },
- { "/", "[]" },
- { "/a", "a" },
- { "/a/b", "a:[000000]b" },
- { "/a/b/c", "a:[b]c" },
- { "/a/b/c/d", "a:[b.c]d" },
- { "/a/b/c/d/e", "a:[b.c.d]e" },
- { "a", "a" },
- { "a/b", "[.a]b" },
- { "a/b/c", "[.a.b]c" },
- { "a/b/c/d", "[.a.b.c]d" },
- };
+ {"", ""},
+ {"/", "[]"},
+ {"/a", "a"},
+ {"/a/b", "a:[000000]b"},
+ {"/a/b/c", "a:[b]c"},
+ {"/a/b/c/d", "a:[b.c]d"},
+ {"/a/b/c/d/e", "a:[b.c.d]e"},
+ {"a", "a"},
+ {"a/b", "[.a]b"},
+ {"a/b/c", "[.a.b]c"},
+ {"a/b/c/d", "[.a.b.c]d"},
+ };
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); i++) {
EXPECT_EQ(kTestCases[i].expected_output,
net::FtpUtil::UnixFilePathToVMS(kTestCases[i].input))
@@ -46,27 +46,27 @@ TEST(FtpUtilTest, UnixDirectoryPathToVMS) {
const char* input;
const char* expected_output;
} kTestCases[] = {
- { "", "" },
- { "/", "" },
- { "/a", "a:[000000]" },
- { "/a/", "a:[000000]" },
- { "/a/b", "a:[b]" },
- { "/a/b/", "a:[b]" },
- { "/a/b/c", "a:[b.c]" },
- { "/a/b/c/", "a:[b.c]" },
- { "/a/b/c/d", "a:[b.c.d]" },
- { "/a/b/c/d/", "a:[b.c.d]" },
- { "/a/b/c/d/e", "a:[b.c.d.e]" },
- { "/a/b/c/d/e/", "a:[b.c.d.e]" },
- { "a", "[.a]" },
- { "a/", "[.a]" },
- { "a/b", "[.a.b]" },
- { "a/b/", "[.a.b]" },
- { "a/b/c", "[.a.b.c]" },
- { "a/b/c/", "[.a.b.c]" },
- { "a/b/c/d", "[.a.b.c.d]" },
- { "a/b/c/d/", "[.a.b.c.d]" },
- };
+ {"", ""},
+ {"/", ""},
+ {"/a", "a:[000000]"},
+ {"/a/", "a:[000000]"},
+ {"/a/b", "a:[b]"},
+ {"/a/b/", "a:[b]"},
+ {"/a/b/c", "a:[b.c]"},
+ {"/a/b/c/", "a:[b.c]"},
+ {"/a/b/c/d", "a:[b.c.d]"},
+ {"/a/b/c/d/", "a:[b.c.d]"},
+ {"/a/b/c/d/e", "a:[b.c.d.e]"},
+ {"/a/b/c/d/e/", "a:[b.c.d.e]"},
+ {"a", "[.a]"},
+ {"a/", "[.a]"},
+ {"a/b", "[.a.b]"},
+ {"a/b/", "[.a.b]"},
+ {"a/b/c", "[.a.b.c]"},
+ {"a/b/c/", "[.a.b.c]"},
+ {"a/b/c/d", "[.a.b.c.d]"},
+ {"a/b/c/d/", "[.a.b.c.d]"},
+ };
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); i++) {
EXPECT_EQ(kTestCases[i].expected_output,
net::FtpUtil::UnixDirectoryPathToVMS(kTestCases[i].input))
@@ -79,34 +79,34 @@ TEST(FtpUtilTest, VMSPathToUnix) {
const char* input;
const char* expected_output;
} kTestCases[] = {
- { "", "." },
- { "[]", "/" },
- { "a", "/a" },
- { "a:[000000]", "/a" },
- { "a:[000000]b", "/a/b" },
- { "a:[b]", "/a/b" },
- { "a:[b]c", "/a/b/c" },
- { "a:[b.c]", "/a/b/c" },
- { "a:[b.c]d", "/a/b/c/d" },
- { "a:[b.c.d]", "/a/b/c/d" },
- { "a:[b.c.d]e", "/a/b/c/d/e" },
- { "a:[b.c.d.e]", "/a/b/c/d/e" },
- { "[.a]", "a" },
- { "[.a]b", "a/b" },
- { "[.a.b]", "a/b" },
- { "[.a.b]c", "a/b/c" },
- { "[.a.b.c]", "a/b/c" },
- { "[.a.b.c]d", "a/b/c/d" },
- { "[.a.b.c.d]", "a/b/c/d" },
- { "[.", "" },
+ {"", "."},
+ {"[]", "/"},
+ {"a", "/a"},
+ {"a:[000000]", "/a"},
+ {"a:[000000]b", "/a/b"},
+ {"a:[b]", "/a/b"},
+ {"a:[b]c", "/a/b/c"},
+ {"a:[b.c]", "/a/b/c"},
+ {"a:[b.c]d", "/a/b/c/d"},
+ {"a:[b.c.d]", "/a/b/c/d"},
+ {"a:[b.c.d]e", "/a/b/c/d/e"},
+ {"a:[b.c.d.e]", "/a/b/c/d/e"},
+ {"[.a]", "a"},
+ {"[.a]b", "a/b"},
+ {"[.a.b]", "a/b"},
+ {"[.a.b]c", "a/b/c"},
+ {"[.a.b.c]", "a/b/c"},
+ {"[.a.b.c]d", "a/b/c/d"},
+ {"[.a.b.c.d]", "a/b/c/d"},
+ {"[.", ""},
- // UNIX emulation:
- { "/", "/" },
- { "/a", "/a" },
- { "/a/b", "/a/b" },
- { "/a/b/c", "/a/b/c" },
- { "/a/b/c/d", "/a/b/c/d" },
- };
+ // UNIX emulation:
+ {"/", "/"},
+ {"/a", "/a"},
+ {"/a/b", "/a/b"},
+ {"/a/b/c", "/a/b/c"},
+ {"/a/b/c/d", "/a/b/c/d"},
+ };
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); i++) {
EXPECT_EQ(kTestCases[i].expected_output,
net::FtpUtil::VMSPathToUnix(kTestCases[i].input))
@@ -132,46 +132,51 @@ TEST(FtpUtilTest, LsDateListingToTime) {
int expected_hour;
int expected_minute;
} kTestCases[] = {
- { "Nov", "01", "2007", 2007, 11, 1, 0, 0 },
- { "Jul", "25", "13:37", 1994, 7, 25, 13, 37 },
+ {"Nov", "01", "2007", 2007, 11, 1, 0, 0},
+ {"Jul", "25", "13:37", 1994, 7, 25, 13, 37},
- // Test date listings in German.
- { "M\xc3\xa4r", "13", "2009", 2009, 3, 13, 0, 0 },
- { "Mai", "1", "10:10", 1994, 5, 1, 10, 10 },
- { "Okt", "14", "21:18", 1994, 10, 14, 21, 18 },
- { "Dez", "25", "2008", 2008, 12, 25, 0, 0 },
+ // Test date listings in German.
+ {"M\xc3\xa4r", "13", "2009", 2009, 3, 13, 0, 0},
+ {"Mai", "1", "10:10", 1994, 5, 1, 10, 10},
+ {"Okt", "14", "21:18", 1994, 10, 14, 21, 18},
+ {"Dez", "25", "2008", 2008, 12, 25, 0, 0},
- // Test date listings in Russian.
- { "\xd1\x8f\xd0\xbd\xd0\xb2", "1", "2011", 2011, 1, 1, 0, 0 },
- { "\xd1\x84\xd0\xb5\xd0\xb2", "1", "2011", 2011, 2, 1, 0, 0 },
- { "\xd0\xbc\xd0\xb0\xd1\x80", "1", "2011", 2011, 3, 1, 0, 0 },
- { "\xd0\xb0\xd0\xbf\xd1\x80", "1", "2011", 2011, 4, 1, 0, 0 },
- { "\xd0\xbc\xd0\xb0\xd0\xb9", "1", "2011", 2011, 5, 1, 0, 0 },
- { "\xd0\xb8\xd1\x8e\xd0\xbd", "1", "2011", 2011, 6, 1, 0, 0 },
- { "\xd0\xb8\xd1\x8e\xd0\xbb", "1", "2011", 2011, 7, 1, 0, 0 },
- { "\xd0\xb0\xd0\xb2\xd0\xb3", "1", "2011", 2011, 8, 1, 0, 0 },
- { "\xd1\x81\xd0\xb5\xd0\xbd", "1", "2011", 2011, 9, 1, 0, 0 },
- { "\xd0\xbe\xd0\xba\xd1\x82", "1", "2011", 2011, 10, 1, 0, 0 },
- { "\xd0\xbd\xd0\xbe\xd1\x8f", "1", "2011", 2011, 11, 1, 0, 0 },
- { "\xd0\xb4\xd0\xb5\xd0\xba", "1", "2011", 2011, 12, 1, 0, 0 },
+ // Test date listings in Russian.
+ {"\xd1\x8f\xd0\xbd\xd0\xb2", "1", "2011", 2011, 1, 1, 0, 0},
+ {"\xd1\x84\xd0\xb5\xd0\xb2", "1", "2011", 2011, 2, 1, 0, 0},
+ {"\xd0\xbc\xd0\xb0\xd1\x80", "1", "2011", 2011, 3, 1, 0, 0},
+ {"\xd0\xb0\xd0\xbf\xd1\x80", "1", "2011", 2011, 4, 1, 0, 0},
+ {"\xd0\xbc\xd0\xb0\xd0\xb9", "1", "2011", 2011, 5, 1, 0, 0},
+ {"\xd0\xb8\xd1\x8e\xd0\xbd", "1", "2011", 2011, 6, 1, 0, 0},
+ {"\xd0\xb8\xd1\x8e\xd0\xbb", "1", "2011", 2011, 7, 1, 0, 0},
+ {"\xd0\xb0\xd0\xb2\xd0\xb3", "1", "2011", 2011, 8, 1, 0, 0},
+ {"\xd1\x81\xd0\xb5\xd0\xbd", "1", "2011", 2011, 9, 1, 0, 0},
+ {"\xd0\xbe\xd0\xba\xd1\x82", "1", "2011", 2011, 10, 1, 0, 0},
+ {"\xd0\xbd\xd0\xbe\xd1\x8f", "1", "2011", 2011, 11, 1, 0, 0},
+ {"\xd0\xb4\xd0\xb5\xd0\xba", "1", "2011", 2011, 12, 1, 0, 0},
- // Test current year detection.
- { "Nov", "01", "12:00", 1994, 11, 1, 12, 0 },
- { "Nov", "15", "12:00", 1994, 11, 15, 12, 0 },
- { "Nov", "16", "12:00", 1993, 11, 16, 12, 0 },
- { "Jan", "01", "08:30", 1994, 1, 1, 8, 30 },
- { "Sep", "02", "09:00", 1994, 9, 2, 9, 0 },
- { "Dec", "06", "21:00", 1993, 12, 6, 21, 0 },
- };
+ // Test current year detection.
+ {"Nov", "01", "12:00", 1994, 11, 1, 12, 0},
+ {"Nov", "15", "12:00", 1994, 11, 15, 12, 0},
+ {"Nov", "16", "12:00", 1993, 11, 16, 12, 0},
+ {"Jan", "01", "08:30", 1994, 1, 1, 8, 30},
+ {"Sep", "02", "09:00", 1994, 9, 2, 9, 0},
+ {"Dec", "06", "21:00", 1993, 12, 6, 21, 0},
+ };
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); i++) {
- SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s %s %s", i,
- kTestCases[i].month, kTestCases[i].day,
+ SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s %s %s",
+ i,
+ kTestCases[i].month,
+ kTestCases[i].day,
kTestCases[i].rest));
base::Time time;
- ASSERT_TRUE(net::FtpUtil::LsDateListingToTime(
- UTF8ToUTF16(kTestCases[i].month), UTF8ToUTF16(kTestCases[i].day),
- UTF8ToUTF16(kTestCases[i].rest), mock_current_time, &time));
+ ASSERT_TRUE(
+ net::FtpUtil::LsDateListingToTime(UTF8ToUTF16(kTestCases[i].month),
+ UTF8ToUTF16(kTestCases[i].day),
+ UTF8ToUTF16(kTestCases[i].rest),
+ mock_current_time,
+ &time));
base::Time::Exploded time_exploded;
time.LocalExplode(&time_exploded);
@@ -198,21 +203,20 @@ TEST(FtpUtilTest, WindowsDateListingToTime) {
int expected_hour;
int expected_minute;
} kTestCases[] = {
- { "11-01-07", "12:42", 2007, 11, 1, 12, 42 },
- { "11-01-07", "12:42AM", 2007, 11, 1, 0, 42 },
- { "11-01-07", "12:42PM", 2007, 11, 1, 12, 42 },
-
- { "11-01-2007", "12:42", 2007, 11, 1, 12, 42 },
- };
+ {"11-01-07", "12:42", 2007, 11, 1, 12, 42},
+ {"11-01-07", "12:42AM", 2007, 11, 1, 0, 42},
+ {"11-01-07", "12:42PM", 2007, 11, 1, 12, 42},
+ {"11-01-2007", "12:42", 2007, 11, 1, 12, 42},
+ };
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); i++) {
- SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s %s", i,
- kTestCases[i].date, kTestCases[i].time));
+ SCOPED_TRACE(base::StringPrintf(
+ "Test[%" PRIuS "]: %s %s", i, kTestCases[i].date, kTestCases[i].time));
base::Time time;
- ASSERT_TRUE(net::FtpUtil::WindowsDateListingToTime(
- UTF8ToUTF16(kTestCases[i].date),
- UTF8ToUTF16(kTestCases[i].time),
- &time));
+ ASSERT_TRUE(
+ net::FtpUtil::WindowsDateListingToTime(UTF8ToUTF16(kTestCases[i].date),
+ UTF8ToUTF16(kTestCases[i].time),
+ &time));
base::Time::Exploded time_exploded;
time.LocalExplode(&time_exploded);
@@ -232,20 +236,22 @@ TEST(FtpUtilTest, GetStringPartAfterColumns) {
int column;
const char* expected_result;
} kTestCases[] = {
- { "", 0, "" },
- { "", 1, "" },
- { "foo abc", 0, "foo abc" },
- { "foo abc", 1, "abc" },
- { " foo abc", 0, "foo abc" },
- { " foo abc", 1, "abc" },
- { " foo abc", 2, "" },
- { " foo abc ", 0, "foo abc" },
- { " foo abc ", 1, "abc" },
- { " foo abc ", 2, "" },
- };
+ {"", 0, ""},
+ {"", 1, ""},
+ {"foo abc", 0, "foo abc"},
+ {"foo abc", 1, "abc"},
+ {" foo abc", 0, "foo abc"},
+ {" foo abc", 1, "abc"},
+ {" foo abc", 2, ""},
+ {" foo abc ", 0, "foo abc"},
+ {" foo abc ", 1, "abc"},
+ {" foo abc ", 2, ""},
+ };
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); i++) {
- SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s %d", i,
- kTestCases[i].text, kTestCases[i].column));
+ SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s %d",
+ i,
+ kTestCases[i].text,
+ kTestCases[i].column));
EXPECT_EQ(ASCIIToUTF16(kTestCases[i].expected_result),
net::FtpUtil::GetStringPartAfterColumns(
« net/base/mime_util_unittest.cc ('K') | « net/ftp/ftp_util.cc ('k') | net/http/des.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698