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

Unified Diff: base/files/file_unittest.cc

Issue 2797283002: Fixing std::swap(x, x) in base. (Closed)
Patch Set: Created 3 years, 8 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: base/files/file_unittest.cc
diff --git a/base/files/file_unittest.cc b/base/files/file_unittest.cc
index 66c312b60d4cff0d296384d829e529db94a74d28..8275bac769c04f133fce7a182e36bb0686560b08 100644
--- a/base/files/file_unittest.cc
+++ b/base/files/file_unittest.cc
@@ -105,6 +105,16 @@ TEST(FileTest, Create) {
EXPECT_FALSE(base::PathExists(file_path));
}
+TEST(FileTest, SelfSwap) {
+ base::ScopedTempDir temp_dir;
+ ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
+ FilePath file_path = temp_dir.GetPath().AppendASCII("create_file_1");
+ File file(file_path,
+ base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_DELETE_ON_CLOSE);
+ std::swap(file, file);
+ EXPECT_TRUE(file.IsValid());
+}
+
TEST(FileTest, Async) {
base::ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());

Powered by Google App Engine
This is Rietveld 408576698