diff options
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Support/ErrorOrTest.cpp | 6 | ||||
-rw-r--r-- | unittests/Support/Path.cpp | 13 |
2 files changed, 16 insertions, 3 deletions
diff --git a/unittests/Support/ErrorOrTest.cpp b/unittests/Support/ErrorOrTest.cpp index aa0ddd5..4853426 100644 --- a/unittests/Support/ErrorOrTest.cpp +++ b/unittests/Support/ErrorOrTest.cpp @@ -18,7 +18,7 @@ using namespace llvm; namespace { ErrorOr<int> t1() {return 1;} -ErrorOr<int> t2() {return make_error_code(errc::invalid_argument);} +ErrorOr<int> t2() { return errc::invalid_argument; } TEST(ErrorOr, SimpleValue) { ErrorOr<int> a = t1(); @@ -45,8 +45,8 @@ TEST(ErrorOr, Types) { *a = 42; EXPECT_EQ(42, x); - EXPECT_FALSE(ErrorOr<void>(make_error_code(errc::broken_pipe))); - EXPECT_TRUE(ErrorOr<void>(make_error_code(errc::success))); + EXPECT_FALSE(ErrorOr<void>(errc::broken_pipe)); + EXPECT_TRUE(ErrorOr<void>(errc::success)); #if LLVM_HAS_CXX11_STDLIB // Move only types. diff --git a/unittests/Support/Path.cpp b/unittests/Support/Path.cpp index 878c227..4511259 100644 --- a/unittests/Support/Path.cpp +++ b/unittests/Support/Path.cpp @@ -224,6 +224,18 @@ TEST_F(FileSystemTest, TempFiles) { // Make sure Temp1 doesn't exist. ASSERT_NO_ERROR(fs::exists(Twine(TempPath), TempFileExists)); EXPECT_FALSE(TempFileExists); + +#ifdef LLVM_ON_WIN32 + // Path name > 260 chars should get an error. + const char *Path270 = + "abcdefghijklmnopqrstuvwxyz9abcdefghijklmnopqrstuvwxyz8" + "abcdefghijklmnopqrstuvwxyz7abcdefghijklmnopqrstuvwxyz6" + "abcdefghijklmnopqrstuvwxyz5abcdefghijklmnopqrstuvwxyz4" + "abcdefghijklmnopqrstuvwxyz3abcdefghijklmnopqrstuvwxyz2" + "abcdefghijklmnopqrstuvwxyz1abcdefghijklmnopqrstuvwxyz0"; + EXPECT_EQ(fs::unique_file(Twine(Path270), FileDescriptor, TempPath), + windows_error::path_not_found); +#endif } TEST_F(FileSystemTest, DirectoryIteration) { @@ -350,6 +362,7 @@ TEST_F(FileSystemTest, FileMapping) { StringRef Val("hello there"); { fs::mapped_file_region mfr(FileDescriptor, + true, fs::mapped_file_region::readwrite, 4096, 0, |