| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkOSFile.h" | 8 #include "SkOSFile.h" |
| 9 #include "SkString.h" | 9 #include "SkString.h" |
| 10 #include "Test.h" | 10 #include "Test.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 // Test with a sub directory. | 80 // Test with a sub directory. |
| 81 dir.append("subDir"); | 81 dir.append("subDir"); |
| 82 test_dir_with_file(reporter, dir, filename); | 82 test_dir_with_file(reporter, dir, filename); |
| 83 | 83 |
| 84 // Basename of a directory with a path separator at the end is empty. | 84 // Basename of a directory with a path separator at the end is empty. |
| 85 dir.appendUnichar(SkPATH_SEPARATOR); | 85 dir.appendUnichar(SkPATH_SEPARATOR); |
| 86 SkString baseOfDir = SkOSPath::Basename(dir.c_str()); | 86 SkString baseOfDir = SkOSPath::Basename(dir.c_str()); |
| 87 REPORTER_ASSERT(reporter, baseOfDir.size() == 0); | 87 REPORTER_ASSERT(reporter, baseOfDir.size() == 0); |
| 88 | 88 |
| 89 // Basename of NULL is an empty string. | 89 // Basename of nullptr is an empty string. |
| 90 SkString empty = SkOSPath::Basename(NULL); | 90 SkString empty = SkOSPath::Basename(nullptr); |
| 91 REPORTER_ASSERT(reporter, empty.size() == 0); | 91 REPORTER_ASSERT(reporter, empty.size() == 0); |
| 92 | 92 |
| 93 // File in root dir | 93 // File in root dir |
| 94 dir.printf("%c", SkPATH_SEPARATOR); | 94 dir.printf("%c", SkPATH_SEPARATOR); |
| 95 filename.set("file"); | 95 filename.set("file"); |
| 96 test_dir_with_file(reporter, dir, filename); | 96 test_dir_with_file(reporter, dir, filename); |
| 97 | 97 |
| 98 // Just the root dir | 98 // Just the root dir |
| 99 filename.reset(); | 99 filename.reset(); |
| 100 test_dir_with_file(reporter, dir, filename); | 100 test_dir_with_file(reporter, dir, filename); |
| 101 | 101 |
| 102 // Test that NULL can be used for the directory and filename. | 102 // Test that nullptr can be used for the directory and filename. |
| 103 SkString emptyPath = SkOSPath::Join(NULL, NULL); | 103 SkString emptyPath = SkOSPath::Join(nullptr, nullptr); |
| 104 REPORTER_ASSERT(reporter, emptyPath.isEmpty()); | 104 REPORTER_ASSERT(reporter, emptyPath.isEmpty()); |
| 105 } | 105 } |
| OLD | NEW |