Browse Source

More cleanup of test case bodies

Sam Jaffe 6 years ago
parent
commit
af0935a44c
1 changed files with 16 additions and 11 deletions
  1. 16 11
      test/match_test.cxx

+ 16 - 11
test/match_test.cxx

@@ -33,11 +33,20 @@ MATCHER(IsUnmatched, negation ? "was matched" : "was not matched") {
 TEST_F(CaseMatcherTest, MatchesCorrectValue) {
   match(ex, b) {
     with(example{1}, true) {
-      EXPECT_THAT(_matcher_local, Not(IsUnmatched()));
     } nomatch() {
       FAIL() << "Unable to match";
     }
-    EXPECT_THAT(_matcher_local, Not(IsUnmatched()));
+  } else {
+    FAIL() << "Unable to construct matcher";
+  }
+}
+
+
+TEST_F(CaseMatcherTest, ImmediatlySetsMatchedProperty) {
+  match(ex, b) {
+    with(example{1}, true) {
+      EXPECT_THAT(_matcher_local, Not(IsUnmatched()));
+    }
   } else {
     FAIL() << "Unable to construct matcher";
   }
@@ -54,15 +63,13 @@ TEST_F(CaseMatcherTest, NonMatchingClauseLeavesUnmatched) {
   }
 }
 
-TEST_F(CaseMatcherTest, CanPassMatchingWithSecondClauseListing) {
+TEST_F(CaseMatcherTest, SetsAsMatchedIfAnyClausePasses) {
   match(ex, b) {
     with(example{1}, false) {
       FAIL() << "Incorrect match!";
     }
-    EXPECT_THAT(_matcher_local, IsUnmatched());
-    with(example{1}, true) {
-      EXPECT_THAT(_matcher_local, Not(IsUnmatched()));
-    }
+
+    with(example{1}, true) {}
     EXPECT_THAT(_matcher_local, Not(IsUnmatched()));
   } else {
     FAIL() << "Unable to construct matcher";
@@ -74,9 +81,7 @@ TEST_F(CaseMatcherTest, CanMatchWithWildcard) {
     with(example{1}, false) {
       FAIL() << "Incorrect match!";
     }
-    with(matcher::any, true) {
-      EXPECT_THAT(_matcher_local, Not(IsUnmatched()));
-    }
+    with(matcher::any, true) {}
     EXPECT_THAT(_matcher_local, Not(IsUnmatched()));
   } else {
     FAIL() << "Unable to construct matcher";
@@ -109,7 +114,7 @@ TEST_F(CaseMatcherTest, CanMatchCompoundList) {
   }
 }
 
-TEST_F(CaseMatcherTest, nomatch_any_of_list_without_self) {
+TEST_F(CaseMatcherTest, WillNotMatchAnyIfNoSubMatches) {
   match(ex, b) {
     with(matcher::any_of(example{0}, example{0xDEADBEEF}), true) {
        FAIL() << "Incorrect match!";