From 044eb2f6afba375a914ac9d8024f8f5142bb912e Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 18 Dec 2017 20:10:56 +0000 Subject: Vendor import of llvm trunk r321017: https://llvm.org/svn/llvm-project/llvm/trunk@321017 --- unittests/Support/FileOutputBufferTest.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'unittests/Support/FileOutputBufferTest.cpp') diff --git a/unittests/Support/FileOutputBufferTest.cpp b/unittests/Support/FileOutputBufferTest.cpp index 5f20634d66c2..e7f1fd765bde 100644 --- a/unittests/Support/FileOutputBufferTest.cpp +++ b/unittests/Support/FileOutputBufferTest.cpp @@ -40,18 +40,18 @@ TEST(FileOutputBuffer, Test) { // TEST 1: Verify commit case. SmallString<128> File1(TestDirectory); - File1.append("/file1"); + File1.append("/file1"); { - ErrorOr> BufferOrErr = + Expected> BufferOrErr = FileOutputBuffer::create(File1, 8192); - ASSERT_NO_ERROR(BufferOrErr.getError()); + ASSERT_NO_ERROR(errorToErrorCode(BufferOrErr.takeError())); std::unique_ptr &Buffer = *BufferOrErr; // Start buffer with special header. memcpy(Buffer->getBufferStart(), "AABBCCDDEEFFGGHHIIJJ", 20); // Write to end of buffer to verify it is writable. memcpy(Buffer->getBufferEnd() - 20, "AABBCCDDEEFFGGHHIIJJ", 20); // Commit buffer. - ASSERT_NO_ERROR(Buffer->commit()); + ASSERT_NO_ERROR(errorToErrorCode(Buffer->commit())); } // Verify file is correct size. @@ -64,9 +64,9 @@ TEST(FileOutputBuffer, Test) { SmallString<128> File2(TestDirectory); File2.append("/file2"); { - ErrorOr> Buffer2OrErr = + Expected> Buffer2OrErr = FileOutputBuffer::create(File2, 8192); - ASSERT_NO_ERROR(Buffer2OrErr.getError()); + ASSERT_NO_ERROR(errorToErrorCode(Buffer2OrErr.takeError())); std::unique_ptr &Buffer2 = *Buffer2OrErr; // Fill buffer with special header. memcpy(Buffer2->getBufferStart(), "AABBCCDDEEFFGGHHIIJJ", 20); @@ -79,17 +79,17 @@ TEST(FileOutputBuffer, Test) { // TEST 3: Verify sizing down case. SmallString<128> File3(TestDirectory); - File3.append("/file3"); + File3.append("/file3"); { - ErrorOr> BufferOrErr = + Expected> BufferOrErr = FileOutputBuffer::create(File3, 8192000); - ASSERT_NO_ERROR(BufferOrErr.getError()); + ASSERT_NO_ERROR(errorToErrorCode(BufferOrErr.takeError())); std::unique_ptr &Buffer = *BufferOrErr; // Start buffer with special header. memcpy(Buffer->getBufferStart(), "AABBCCDDEEFFGGHHIIJJ", 20); // Write to end of buffer to verify it is writable. memcpy(Buffer->getBufferEnd() - 20, "AABBCCDDEEFFGGHHIIJJ", 20); - ASSERT_NO_ERROR(Buffer->commit()); + ASSERT_NO_ERROR(errorToErrorCode(Buffer->commit())); } // Verify file is correct size. @@ -100,16 +100,16 @@ TEST(FileOutputBuffer, Test) { // TEST 4: Verify file can be made executable. SmallString<128> File4(TestDirectory); - File4.append("/file4"); + File4.append("/file4"); { - ErrorOr> BufferOrErr = + Expected> BufferOrErr = FileOutputBuffer::create(File4, 8192, FileOutputBuffer::F_executable); - ASSERT_NO_ERROR(BufferOrErr.getError()); + ASSERT_NO_ERROR(errorToErrorCode(BufferOrErr.takeError())); std::unique_ptr &Buffer = *BufferOrErr; // Start buffer with special header. memcpy(Buffer->getBufferStart(), "AABBCCDDEEFFGGHHIIJJ", 20); // Commit buffer. - ASSERT_NO_ERROR(Buffer->commit()); + ASSERT_NO_ERROR(errorToErrorCode(Buffer->commit())); } // Verify file exists and is executable. fs::file_status Status; -- cgit v1.2.3