| 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 10 matching lines...) Expand all Loading... |
| 21 TEST_CASE(DirectoryCurrent) { | 21 TEST_CASE(DirectoryCurrent) { |
| 22 const char* current = dart::bin::Directory::Current(); | 22 const char* current = dart::bin::Directory::Current(); |
| 23 EXPECT_NOTNULL(current); | 23 EXPECT_NOTNULL(current); |
| 24 } | 24 } |
| 25 | 25 |
| 26 | 26 |
| 27 TEST_CASE(DirectoryExists) { | 27 TEST_CASE(DirectoryExists) { |
| 28 const char* current = dart::bin::Directory::Current(); | 28 const char* current = dart::bin::Directory::Current(); |
| 29 EXPECT_NOTNULL(current); | 29 EXPECT_NOTNULL(current); |
| 30 | 30 |
| 31 dart::bin::Directory::ExistsResult r = | 31 dart::bin::Directory::ExistsResult r = dart::bin::Directory::Exists(current); |
| 32 dart::bin::Directory::Exists(current); | |
| 33 EXPECT_EQ(dart::bin::Directory::EXISTS, r); | 32 EXPECT_EQ(dart::bin::Directory::EXISTS, r); |
| 34 } | 33 } |
| 35 | 34 |
| 36 | 35 |
| 37 TEST_CASE(DirectorySystemTemp) { | 36 TEST_CASE(DirectorySystemTemp) { |
| 38 const char* system_temp = dart::bin::Directory::SystemTemp(); | 37 const char* system_temp = dart::bin::Directory::SystemTemp(); |
| 39 EXPECT_NOTNULL(system_temp); | 38 EXPECT_NOTNULL(system_temp); |
| 40 } | 39 } |
| 41 | 40 |
| 42 | 41 |
| 42 TEST_CASE(DirectorySystemTempExists) { |
| 43 const char* system_temp = dart::bin::Directory::SystemTemp(); |
| 44 EXPECT_NOTNULL(system_temp); |
| 45 |
| 46 dart::bin::Directory::ExistsResult r = |
| 47 dart::bin::Directory::Exists(system_temp); |
| 48 EXPECT_EQ(dart::bin::Directory::EXISTS, r); |
| 49 } |
| 50 |
| 51 |
| 43 TEST_CASE(DirectoryCreateTemp) { | 52 TEST_CASE(DirectoryCreateTemp) { |
| 44 const char* kTempPrefix = "test_prefix"; | 53 const char* kTempPrefix = "test_prefix"; |
| 45 const char* system_temp = dart::bin::Directory::SystemTemp(); | 54 const char* system_temp = dart::bin::Directory::SystemTemp(); |
| 46 EXPECT_NOTNULL(system_temp); | 55 EXPECT_NOTNULL(system_temp); |
| 47 | 56 |
| 48 const char* temp_dir = dart::bin::Directory::CreateTemp(kTempPrefix); | 57 const char* temp_dir = dart::bin::Directory::CreateTemp(kTempPrefix); |
| 49 EXPECT_NOTNULL(temp_dir); | 58 EXPECT_NOTNULL(temp_dir); |
| 50 | 59 |
| 51 // Make sure temp_dir contains test_prefix. | 60 // Make sure temp_dir contains test_prefix. |
| 52 EXPECT_NOTNULL(strstr(temp_dir, kTempPrefix)); | 61 EXPECT_NOTNULL(strstr(temp_dir, kTempPrefix)); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 141 |
| 133 r = dart::bin::Directory::Exists(name); | 142 r = dart::bin::Directory::Exists(name); |
| 134 EXPECT_EQ(dart::bin::Directory::DOES_NOT_EXIST, r); | 143 EXPECT_EQ(dart::bin::Directory::DOES_NOT_EXIST, r); |
| 135 | 144 |
| 136 EXPECT(dart::bin::Directory::Delete(new_name, false)); | 145 EXPECT(dart::bin::Directory::Delete(new_name, false)); |
| 137 delete[] name; | 146 delete[] name; |
| 138 delete[] new_name; | 147 delete[] new_name; |
| 139 } | 148 } |
| 140 | 149 |
| 141 } // namespace dart | 150 } // namespace dart |
| OLD | NEW |