OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 testing_->StartObject("") | 142 testing_->StartObject("") |
143 ->RenderDouble("doubleValue", 1.0) | 143 ->RenderDouble("doubleValue", 1.0) |
144 ->RenderString("unknown", "abc") | 144 ->RenderString("unknown", "abc") |
145 ->StartObject("unknownObject") | 145 ->StartObject("unknownObject") |
146 ->RenderString("unknown", "def") | 146 ->RenderString("unknown", "def") |
147 ->EndObject() | 147 ->EndObject() |
148 ->EndObject(); | 148 ->EndObject(); |
149 } | 149 } |
150 | 150 |
151 | 151 |
| 152 class DefaultValueObjectWriterSuppressListTest |
| 153 : public BaseDefaultValueObjectWriterTest { |
| 154 protected: |
| 155 DefaultValueObjectWriterSuppressListTest() |
| 156 : BaseDefaultValueObjectWriterTest(DefaultValueTest::descriptor()) { |
| 157 testing_->set_suppress_empty_list(true); |
| 158 } |
| 159 ~DefaultValueObjectWriterSuppressListTest() {} |
| 160 }; |
| 161 |
| 162 INSTANTIATE_TEST_CASE_P(DifferentTypeInfoSourceTest, |
| 163 DefaultValueObjectWriterSuppressListTest, |
| 164 ::testing::Values( |
| 165 testing::USE_TYPE_RESOLVER)); |
| 166 |
| 167 TEST_P(DefaultValueObjectWriterSuppressListTest, Empty) { |
| 168 // Set expectation. Emtpy lists should be suppressed. |
| 169 expects_.StartObject("") |
| 170 ->RenderDouble("doubleValue", 0.0) |
| 171 ->RenderFloat("floatValue", 0.0) |
| 172 ->RenderInt64("int64Value", 0) |
| 173 ->RenderUint64("uint64Value", 0) |
| 174 ->RenderInt32("int32Value", 0) |
| 175 ->RenderUint32("uint32Value", 0) |
| 176 ->RenderBool("boolValue", false) |
| 177 ->RenderString("stringValue", "") |
| 178 ->RenderBytes("bytesValue", "") |
| 179 ->RenderString("enumValue", "ENUM_FIRST") |
| 180 ->EndObject(); |
| 181 |
| 182 // Actual testing |
| 183 testing_->StartObject("")->EndObject(); |
| 184 } |
152 } // namespace testing | 185 } // namespace testing |
153 } // namespace converter | 186 } // namespace converter |
154 } // namespace util | 187 } // namespace util |
155 } // namespace protobuf | 188 } // namespace protobuf |
156 } // namespace google | 189 } // namespace google |
OLD | NEW |