diff options
author | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2016-02-29 20:00:39 +0900 |
---|---|---|
committer | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2016-02-29 20:00:39 +0900 |
commit | 4a888024476b76f8ad7e10266ce179f0fc8af077 (patch) | |
tree | 004b44f32721e3518e1c7fd36af7ef707e96d0ee /strutil_test.cc | |
parent | 01406297a23201b3f99dfb316e7bb4e64b0472c3 (diff) | |
download | android_build_kati-4a888024476b76f8ad7e10266ce179f0fc8af077.tar.gz android_build_kati-4a888024476b76f8ad7e10266ce179f0fc8af077.tar.bz2 android_build_kati-4a888024476b76f8ad7e10266ce179f0fc8af077.zip |
[C++] Honor string length in FindEndOfLine
When the character after the string is a backslash,
FindOfLine returned a wrong length.
Diffstat (limited to 'strutil_test.cc')
-rw-r--r-- | strutil_test.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/strutil_test.cc b/strutil_test.cc index 960c89a..a89786f 100644 --- a/strutil_test.cc +++ b/strutil_test.cc @@ -133,8 +133,9 @@ void TestEscapeShell() { void TestFindEndOfLine() { size_t lf_cnt = 0; ASSERT_EQ(FindEndOfLine("foo", 0, &lf_cnt), 3); - char buf[10] = {'f', 'o', 'o', '\0', 'x', 'y'}; + char buf[10] = {'f', 'o', '\\', '\0', 'x', 'y'}; ASSERT_EQ(FindEndOfLine(StringPiece(buf, 6), 0, &lf_cnt), 3); + ASSERT_EQ(FindEndOfLine(StringPiece(buf, 2), 0, &lf_cnt), 2); } } // namespace |