MozAssertions.h (1119B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_gtest_MozAssertions_h__ 8 #define mozilla_gtest_MozAssertions_h__ 9 10 #include "gtest/gtest.h" 11 #include "nsError.h" 12 13 namespace mozilla::gtest { 14 15 testing::AssertionResult IsNsresultSuccess(const char* expr, nsresult rv); 16 testing::AssertionResult IsNsresultFailure(const char* expr, nsresult rv); 17 18 } // namespace mozilla::gtest 19 20 #define EXPECT_NS_SUCCEEDED(expr) \ 21 EXPECT_PRED_FORMAT1(::mozilla::gtest::IsNsresultSuccess, (expr)) 22 23 #define ASSERT_NS_SUCCEEDED(expr) \ 24 ASSERT_PRED_FORMAT1(::mozilla::gtest::IsNsresultSuccess, (expr)) 25 26 #define EXPECT_NS_FAILED(expr) \ 27 EXPECT_PRED_FORMAT1(::mozilla::gtest::IsNsresultFailure, (expr)) 28 29 #define ASSERT_NS_FAILED(expr) \ 30 ASSERT_PRED_FORMAT1(::mozilla::gtest::IsNsresultFailure, (expr)) 31 32 #endif // mozilla_gtest_MozAssertions_h__