summaryrefslogtreecommitdiff
path: root/src/google/protobuf/dynamic_message_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/dynamic_message_unittest.cc')
-rw-r--r--src/google/protobuf/dynamic_message_unittest.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/google/protobuf/dynamic_message_unittest.cc b/src/google/protobuf/dynamic_message_unittest.cc
index 2167475d..5f7af94e 100644
--- a/src/google/protobuf/dynamic_message_unittest.cc
+++ b/src/google/protobuf/dynamic_message_unittest.cc
@@ -127,5 +127,20 @@ TEST_F(DynamicMessageTest, Extensions) {
reflection_tester.ExpectAllFieldsSetViaReflection(*message);
}
+TEST_F(DynamicMessageTest, SpaceUsed) {
+ // Test that SpaceUsed() works properly
+
+ // Since we share the implementation with generated messages, we don't need
+ // to test very much here. Just make sure it appears to be working.
+
+ scoped_ptr<Message> message(prototype_->New());
+ TestUtil::ReflectionTester reflection_tester(descriptor_);
+
+ int initial_space_used = message->SpaceUsed();
+
+ reflection_tester.SetAllFieldsViaReflection(message.get());
+ EXPECT_LT(initial_space_used, message->SpaceUsed());
+}
+
} // namespace protobuf
} // namespace google