summaryrefslogtreecommitdiffstats
path: root/googletest/include/gtest/gtest.h
diff options
context:
space:
mode:
authorArseny Aprelev <arseny.aprelev@gmail.com>2018-10-01 20:47:09 (GMT)
committerGennadiy Civil <misterg@google.com>2018-10-02 17:03:28 (GMT)
commit00938b2b228f3b70d3d9e51f29a1505bdad43f1e (patch)
tree2bebc032627672911353925d14d1fce101a36029 /googletest/include/gtest/gtest.h
parent2e91bbcf6f33eb85451001be2d4c95cca86ea9fc (diff)
downloadgoogletest-00938b2b228f3b70d3d9e51f29a1505bdad43f1e.zip
googletest-00938b2b228f3b70d3d9e51f29a1505bdad43f1e.tar.gz
googletest-00938b2b228f3b70d3d9e51f29a1505bdad43f1e.tar.bz2
Merge 2ce0685f76a4db403b7b2650433a584c150f2108 into 75e834700d19aa373b428c7c746f951737354c28
Closes #1544 With refinements and changes PiperOrigin-RevId: 215273083
Diffstat (limited to 'googletest/include/gtest/gtest.h')
-rw-r--r--googletest/include/gtest/gtest.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h
index 5df4b0a..8921418 100644
--- a/googletest/include/gtest/gtest.h
+++ b/googletest/include/gtest/gtest.h
@@ -440,6 +440,9 @@ class GTEST_API_ Test {
// Returns true iff the current test has a non-fatal failure.
static bool HasNonfatalFailure();
+ // Returns true iff the current test was skipped.
+ static bool IsSkipped();
+
// Returns true iff the current test has a (either fatal or
// non-fatal) failure.
static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); }
@@ -574,7 +577,10 @@ class GTEST_API_ TestResult {
int test_property_count() const;
// Returns true iff the test passed (i.e. no test part failed).
- bool Passed() const { return !Failed(); }
+ bool Passed() const { return !Skipped() && !Failed(); }
+
+ // Returns true iff the test was skipped.
+ bool Skipped() const;
// Returns true iff the test failed.
bool Failed() const;
@@ -854,6 +860,9 @@ class GTEST_API_ TestCase {
// Gets the number of successful tests in this test case.
int successful_test_count() const;
+ // Gets the number of skipped tests in this test case.
+ int skipped_test_count() const;
+
// Gets the number of failed tests in this test case.
int failed_test_count() const;
@@ -936,6 +945,11 @@ class GTEST_API_ TestCase {
return test_info->should_run() && test_info->result()->Passed();
}
+ // Returns true iff test skipped.
+ static bool TestSkipped(const TestInfo* test_info) {
+ return test_info->should_run() && test_info->result()->Skipped();
+ }
+
// Returns true iff test failed.
static bool TestFailed(const TestInfo* test_info) {
return test_info->should_run() && test_info->result()->Failed();
@@ -1258,6 +1272,9 @@ class GTEST_API_ UnitTest {
// Gets the number of successful tests.
int successful_test_count() const;
+ // Gets the number of skipped tests.
+ int skipped_test_count() const;
+
// Gets the number of failed tests.
int failed_test_count() const;
@@ -1835,6 +1852,11 @@ class TestWithParam : public Test, public WithParamInterface<T> {
// Macros for indicating success/failure in test code.
+// Skips test in runtime.
+// Skipping test aborts current function.
+// Skipped tests are neither successful nor failed.
+#define GTEST_SKIP() GTEST_SKIP_("Skipped")
+
// ADD_FAILURE unconditionally adds a failure to the current test.
// SUCCEED generates a success - it doesn't automatically make the
// current test successful, as a test is only successful when it has