test/message/read: Add missing variant skip

We were missing a test of the variant code which is used when the type
of the variant provided by the caller does not contain the type needed
at runtime to store the data in the message. This tests to make sure
that the skip is issued correctly when we can't read out the member.

Tested:
    Unit tests still build and pass

Change-Id: I41fdc3e40589f1feedfadc3ab33fe808ff3a6d16
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/test/message/read.cpp b/test/message/read.cpp
index 1b6ae84..89f6af0 100644
--- a/test/message/read.cpp
+++ b/test/message/read.cpp
@@ -61,6 +61,12 @@
             .WillOnce(Return(ret));
     }
 
+    void expect_skip(const char *contents)
+    {
+        EXPECT_CALL(mock, sd_bus_message_skip(nullptr, StrEq(contents)))
+            .WillOnce(Return(0));
+    }
+
     void expect_enter_container(char type, const char *contents)
     {
         EXPECT_CALL(mock, sd_bus_message_enter_container(nullptr, type,
@@ -311,6 +317,18 @@
     EXPECT_EQ(v2, ret_v2);
 }
 
+TEST_F(ReadTest, VariantSkipUnmatched)
+{
+    {
+        testing::InSequence seq;
+        expect_verify_type(SD_BUS_TYPE_VARIANT, "i", false);
+        expect_verify_type(SD_BUS_TYPE_VARIANT, "b", false);
+        expect_skip("v");
+    }
+    sdbusplus::message::variant<int, bool> ret;
+    new_message().read(ret);
+}
+
 TEST_F(ReadTest, LargeCombo)
 {
     const std::vector<std::set<std::string>> vas{