diff options
Diffstat (limited to 'net/ftp/ftp_util_unittest.cc')
-rw-r--r-- | net/ftp/ftp_util_unittest.cc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/net/ftp/ftp_util_unittest.cc b/net/ftp/ftp_util_unittest.cc index 46db873d..e929aed 100644 --- a/net/ftp/ftp_util_unittest.cc +++ b/net/ftp/ftp_util_unittest.cc @@ -150,4 +150,31 @@ TEST(FtpUtilTest, LsDateListingToTime) { } } +TEST(FtpUtilTest, GetStringPartAfterColumns) { + const struct { + const char* text; + 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, "" }, + }; + for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); i++) { + SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]: %s %d", + i, kTestCases[i].text, kTestCases[i].column)); + + EXPECT_EQ(ASCIIToUTF16(kTestCases[i].expected_result), + net::FtpUtil::GetStringPartAfterColumns( + ASCIIToUTF16(kTestCases[i].text), kTestCases[i].column)); + } +} + } // namespace |