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

Unified Diff: base/file_util_unittest.cc

Issue 2990: Fixes bug in file_util::ReplaceExtension that could chop off path... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 3 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
« no previous file with comments | « base/file_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_unittest.cc
===================================================================
--- base/file_util_unittest.cc (revision 2409)
+++ base/file_util_unittest.cc (working copy)
@@ -819,6 +819,18 @@
}
}
+// Make sure ReplaceExtension doesn't replace an extension that occurs as one of
+// the directory names of the path.
+TEST_F(FileUtilTest, ReplaceExtensionTestWithPathSeparators) {
+ std::wstring path;
+ file_util::AppendToPath(&path, L"foo.bar");
+ file_util::AppendToPath(&path, L"foo");
+ // '/foo.bar/foo' with extension '.baz'
+ std::wstring result_path = path;
+ file_util::ReplaceExtension(&result_path, L".baz");
+ EXPECT_EQ(path + L".baz", result_path);
+}
+
TEST_F(FileUtilTest, FileEnumeratorTest) {
// Test an empty directory.
file_util::FileEnumerator f0(test_dir_, true,
« no previous file with comments | « base/file_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698