| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "bin/directory.h" | 5 #include "bin/directory.h" |
| 6 #include "include/dart_api.h" | 6 #include "include/dart_api.h" |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/isolate.h" | 8 #include "vm/isolate.h" |
| 9 #include "vm/thread.h" | 9 #include "vm/thread.h" |
| 10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 EXPECT(dart::bin::Directory::Create(name)); | 124 EXPECT(dart::bin::Directory::Create(name)); |
| 125 | 125 |
| 126 // Make sure it exists. | 126 // Make sure it exists. |
| 127 dart::bin::Directory::ExistsResult r = dart::bin::Directory::Exists(name); | 127 dart::bin::Directory::ExistsResult r = dart::bin::Directory::Exists(name); |
| 128 EXPECT_EQ(dart::bin::Directory::EXISTS, r); | 128 EXPECT_EQ(dart::bin::Directory::EXISTS, r); |
| 129 | 129 |
| 130 const intptr_t new_name_len = | 130 const intptr_t new_name_len = |
| 131 snprintf(NULL, 0, "%s/%snewname", system_temp, kTempDirName); | 131 snprintf(NULL, 0, "%s/%snewname", system_temp, kTempDirName); |
| 132 ASSERT(new_name_len > 0); | 132 ASSERT(new_name_len > 0); |
| 133 char* new_name = new char[new_name_len + 1]; | 133 char* new_name = new char[new_name_len + 1]; |
| 134 snprintf(new_name, new_name_len + 1, "%s/%snewname", | 134 snprintf(new_name, new_name_len + 1, "%s/%snewname", system_temp, |
| 135 system_temp, kTempDirName); | 135 kTempDirName); |
| 136 | 136 |
| 137 EXPECT(dart::bin::Directory::Rename(name, new_name)); | 137 EXPECT(dart::bin::Directory::Rename(name, new_name)); |
| 138 | 138 |
| 139 r = dart::bin::Directory::Exists(new_name); | 139 r = dart::bin::Directory::Exists(new_name); |
| 140 EXPECT_EQ(dart::bin::Directory::EXISTS, r); | 140 EXPECT_EQ(dart::bin::Directory::EXISTS, r); |
| 141 | 141 |
| 142 r = dart::bin::Directory::Exists(name); | 142 r = dart::bin::Directory::Exists(name); |
| 143 EXPECT_EQ(dart::bin::Directory::DOES_NOT_EXIST, r); | 143 EXPECT_EQ(dart::bin::Directory::DOES_NOT_EXIST, r); |
| 144 | 144 |
| 145 EXPECT(dart::bin::Directory::Delete(new_name, false)); | 145 EXPECT(dart::bin::Directory::Delete(new_name, false)); |
| 146 delete[] name; | 146 delete[] name; |
| 147 delete[] new_name; | 147 delete[] new_name; |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace dart | 150 } // namespace dart |
| OLD | NEW |