// Copyright 2018 The Dawn & Tint Authors // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // 3. Neither the name of the copyright holder nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <memory> #include "dawn/native/Error.h" #include "dawn/native/ErrorData.h" #include "gtest/gtest.h" namespace dawn::native { namespace { int placeholderSuccess = …; constexpr const char* placeholderErrorMessage = …; // Check returning a success MaybeError with {}; TEST(ErrorTests, Error_Success) { … } // Check returning an error MaybeError with "return DAWN_VALIDATION_ERROR" TEST(ErrorTests, Error_Error) { … } // Check returning a success ResultOrError with an implicit conversion TEST(ErrorTests, ResultOrError_Success) { … } // Check returning an error ResultOrError with "return DAWN_VALIDATION_ERROR" TEST(ErrorTests, ResultOrError_Error) { … } // Check DAWN_TRY handles successes correctly. TEST(ErrorTests, TRY_Success) { … } // Check DAWN_TRY handles errors correctly. TEST(ErrorTests, TRY_Error) { … } // Check DAWN_TRY adds to the backtrace. TEST(ErrorTests, TRY_AddsToBacktrace) { … } // Check DAWN_TRY_ASSIGN handles successes correctly. TEST(ErrorTests, TRY_RESULT_Success) { … } // Check DAWN_TRY_ASSIGN handles errors correctly. TEST(ErrorTests, TRY_RESULT_Error) { … } // Check DAWN_TRY_ASSIGN adds to the backtrace. TEST(ErrorTests, TRY_RESULT_AddsToBacktrace) { … } // Check a ResultOrError can be DAWN_TRY_ASSIGNED in a function that returns an Error TEST(ErrorTests, TRY_RESULT_ConversionToError) { … } // Check a ResultOrError can be DAWN_TRY_ASSIGNED in a function that returns an Error // Version without Result<E*, T*> TEST(ErrorTests, TRY_RESULT_ConversionToErrorNonPointer) { … } // Check DAWN_TRY_ASSIGN handles successes correctly. TEST(ErrorTests, TRY_RESULT_CLEANUP_Success) { … } // Check DAWN_TRY_ASSIGN handles cleanups. TEST(ErrorTests, TRY_RESULT_CLEANUP_Cleanup) { … } // Check DAWN_TRY_ASSIGN can override return value when needed. TEST(ErrorTests, TRY_RESULT_CLEANUP_OverrideReturn) { … } // Check a MaybeError can be DAWN_TRIED in a function that returns an ResultOrError // Check DAWN_TRY handles errors correctly. TEST(ErrorTests, TRY_ConversionToErrorOrResult) { … } // Check a MaybeError can be DAWN_TRIED in a function that returns an ResultOrError // Check DAWN_TRY handles errors correctly. Version without Result<E*, T*> TEST(ErrorTests, TRY_ConversionToErrorOrResultNonPointer) { … } } // namespace } // namespace dawn::native