| 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" |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 UNIT_TEST_CASE(DirectoryCurrentNoScope) { | 14 UNIT_TEST_CASE(DirectoryCurrentNoScope) { |
| 15 char* current_dir = dart::bin::Directory::CurrentNoScope(); | 15 char* current_dir = dart::bin::Directory::CurrentNoScope(); |
| 16 EXPECT_NOTNULL(current_dir); | 16 EXPECT_NOTNULL(current_dir); |
| 17 free(current_dir); | 17 free(current_dir); |
| 18 } | 18 } |
| 19 | 19 |
| 20 | 20 |
| 21 UNIT_TEST_CASE(DirectoryExists) { | |
| 22 char* current_dir = dart::bin::Directory::CurrentNoScope(); | |
| 23 EXPECT_NOTNULL(current_dir); | |
| 24 | |
| 25 dart::bin::Directory::ExistsResult r = | |
| 26 dart::bin::Directory::Exists(current_dir); | |
| 27 EXPECT_EQ(dart::bin::Directory::EXISTS, r); | |
| 28 | |
| 29 free(current_dir); | |
| 30 } | |
| 31 | |
| 32 | |
| 33 TEST_CASE(DirectoryCurrent) { | 21 TEST_CASE(DirectoryCurrent) { |
| 34 const char* current = dart::bin::Directory::Current(); | 22 const char* current = dart::bin::Directory::Current(); |
| 35 EXPECT_NOTNULL(current); | 23 EXPECT_NOTNULL(current); |
| 36 } | 24 } |
| 37 | 25 |
| 38 | 26 |
| 27 TEST_CASE(DirectoryExists) { |
| 28 const char* current = dart::bin::Directory::Current(); |
| 29 EXPECT_NOTNULL(current); |
| 30 |
| 31 dart::bin::Directory::ExistsResult r = |
| 32 dart::bin::Directory::Exists(current); |
| 33 EXPECT_EQ(dart::bin::Directory::EXISTS, r); |
| 34 } |
| 35 |
| 36 |
| 39 TEST_CASE(DirectorySystemTemp) { | 37 TEST_CASE(DirectorySystemTemp) { |
| 40 const char* system_temp = dart::bin::Directory::SystemTemp(); | 38 const char* system_temp = dart::bin::Directory::SystemTemp(); |
| 41 EXPECT_NOTNULL(system_temp); | 39 EXPECT_NOTNULL(system_temp); |
| 42 } | 40 } |
| 43 | 41 |
| 44 | 42 |
| 45 TEST_CASE(DirectoryCreateTemp) { | 43 TEST_CASE(DirectoryCreateTemp) { |
| 46 const char* kTempPrefix = "test_prefix"; | 44 const char* kTempPrefix = "test_prefix"; |
| 47 const char* system_temp = dart::bin::Directory::SystemTemp(); | 45 const char* system_temp = dart::bin::Directory::SystemTemp(); |
| 48 EXPECT_NOTNULL(system_temp); | 46 EXPECT_NOTNULL(system_temp); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 132 |
| 135 r = dart::bin::Directory::Exists(name); | 133 r = dart::bin::Directory::Exists(name); |
| 136 EXPECT_EQ(dart::bin::Directory::DOES_NOT_EXIST, r); | 134 EXPECT_EQ(dart::bin::Directory::DOES_NOT_EXIST, r); |
| 137 | 135 |
| 138 EXPECT(dart::bin::Directory::Delete(new_name, false)); | 136 EXPECT(dart::bin::Directory::Delete(new_name, false)); |
| 139 delete[] name; | 137 delete[] name; |
| 140 delete[] new_name; | 138 delete[] new_name; |
| 141 } | 139 } |
| 142 | 140 |
| 143 } // namespace dart | 141 } // namespace dart |
| OLD | NEW |