@@ -1177,26 +1177,6 @@ final class Test_JSONDefaultValues: XCTestCase {
1177
1177
1178
1178
func testProto2( ) {
1179
1179
let expected = " { "
1180
- + #""optionalInt32":0,"#
1181
- + #""optionalInt64":"0","#
1182
- + #""optionalUint32":0,"#
1183
- + #""optionalUint64":"0","#
1184
- + #""optionalSint32":0,"#
1185
- + #""optionalSint64":"0","#
1186
- + #""optionalFixed32":0,"#
1187
- + #""optionalFixed64":"0","#
1188
- + #""optionalSfixed32":0,"#
1189
- + #""optionalSfixed64":"0","#
1190
- + #""optionalFloat":0.0,"#
1191
- + #""optionalDouble":0.0,"#
1192
- + #""optionalBool":false,"#
1193
- + #""optionalString":"","#
1194
- + #""optionalBytes":"","#
1195
- + #""optionalNestedEnum":"FOO","#
1196
- + #""optionalForeignEnum":"FOREIGN_FOO","#
1197
- + #""optionalImportEnum":"IMPORT_FOO","#
1198
- + #""optionalStringPiece":"","#
1199
- + #""optionalCord":"","#
1200
1180
+ #""repeatedInt32":[],"#
1201
1181
+ #""repeatedInt64":[],"#
1202
1182
+ #""repeatedUint32":[],"#
@@ -1220,27 +1200,7 @@ final class Test_JSONDefaultValues: XCTestCase {
1220
1200
+ #""repeatedImportEnum":[],"#
1221
1201
+ #""repeatedStringPiece":[],"#
1222
1202
+ #""repeatedCord":[],"#
1223
- + #""repeatedLazyMessage":[],"#
1224
- + #""defaultInt32":41,"#
1225
- + #""defaultInt64":"42","#
1226
- + #""defaultUint32":43,"#
1227
- + #""defaultUint64":"44","#
1228
- + #""defaultSint32":-45,"#
1229
- + #""defaultSint64":"46","#
1230
- + #""defaultFixed32":47,"#
1231
- + #""defaultFixed64":"48","#
1232
- + #""defaultSfixed32":49,"#
1233
- + #""defaultSfixed64":"-50","#
1234
- + #""defaultFloat":51.5,"#
1235
- + #""defaultDouble":52000.0,"#
1236
- + #""defaultBool":true,"#
1237
- + #""defaultString":"hello","#
1238
- + #""defaultBytes":"d29ybGQ=","#
1239
- + #""defaultNestedEnum":"BAR","#
1240
- + #""defaultForeignEnum":"FOREIGN_BAR","#
1241
- + #""defaultImportEnum":"IMPORT_BAR","#
1242
- + #""defaultStringPiece":"abc","#
1243
- + #""defaultCord":"123""#
1203
+ + #""repeatedLazyMessage":[]"#
1244
1204
+ " } "
1245
1205
1246
1206
var encodingOptions = JSONEncodingOptions ( )
@@ -1251,27 +1211,9 @@ final class Test_JSONDefaultValues: XCTestCase {
1251
1211
1252
1212
func testProto2Configured( ) {
1253
1213
let expected = " { "
1254
- + #""optionalInt32":0,"#
1255
- + #""optionalInt64":"0","#
1256
- + #""optionalUint32":0,"#
1257
- + #""optionalUint64":"0","#
1258
- + #""optionalSint32":0,"#
1259
- + #""optionalSint64":"0","#
1260
- + #""optionalFixed32":0,"#
1261
- + #""optionalFixed64":"0","#
1262
- + #""optionalSfixed32":0,"#
1263
- + #""optionalSfixed64":"0","#
1264
- + #""optionalFloat":0.0,"#
1265
- + #""optionalDouble":0.0,"#
1266
- + #""optionalBool":false,"#
1267
1214
+ #""optionalString":"i am a test string value","#
1268
1215
+ #""optionalBytes":"aSBhbSBhIHRlc3Qgc3RyaW5nIHZhbHVl","#
1269
- + #""optionalNestedMessage":{"bb":0},"#
1270
- + #""optionalNestedEnum":"FOO","#
1271
- + #""optionalForeignEnum":"FOREIGN_FOO","#
1272
- + #""optionalImportEnum":"IMPORT_FOO","#
1273
- + #""optionalStringPiece":"","#
1274
- + #""optionalCord":"","#
1216
+ + #""optionalNestedMessage":{},"#
1275
1217
+ #""repeatedInt32":[],"#
1276
1218
+ #""repeatedInt64":[],"#
1277
1219
+ #""repeatedUint32":[],"#
@@ -1295,27 +1237,7 @@ final class Test_JSONDefaultValues: XCTestCase {
1295
1237
+ #""repeatedImportEnum":[],"#
1296
1238
+ #""repeatedStringPiece":[],"#
1297
1239
+ #""repeatedCord":[],"#
1298
- + #""repeatedLazyMessage":[],"#
1299
- + #""defaultInt32":41,"#
1300
- + #""defaultInt64":"42","#
1301
- + #""defaultUint32":43,"#
1302
- + #""defaultUint64":"44","#
1303
- + #""defaultSint32":-45,"#
1304
- + #""defaultSint64":"46","#
1305
- + #""defaultFixed32":47,"#
1306
- + #""defaultFixed64":"48","#
1307
- + #""defaultSfixed32":49,"#
1308
- + #""defaultSfixed64":"-50","#
1309
- + #""defaultFloat":51.5,"#
1310
- + #""defaultDouble":52000.0,"#
1311
- + #""defaultBool":true,"#
1312
- + #""defaultString":"hello","#
1313
- + #""defaultBytes":"d29ybGQ=","#
1314
- + #""defaultNestedEnum":"BAR","#
1315
- + #""defaultForeignEnum":"FOREIGN_BAR","#
1316
- + #""defaultImportEnum":"IMPORT_BAR","#
1317
- + #""defaultStringPiece":"abc","#
1318
- + #""defaultCord":"123""#
1240
+ + #""repeatedLazyMessage":[]"#
1319
1241
+ " } "
1320
1242
1321
1243
var encodingOptions = JSONEncodingOptions ( )
@@ -1329,37 +1251,7 @@ final class Test_JSONDefaultValues: XCTestCase {
1329
1251
}
1330
1252
1331
1253
func testExtremeDefaultValues( ) {
1332
- let expected = " { "
1333
- + #""escapedBytes":"AAEHCAwKDQkLXCci/g==","#
1334
- + #""largeUint32":4294967295,"#
1335
- + #""largeUint64":"18446744073709551615","#
1336
- + #""smallInt32":-2147483647,"#
1337
- + #""smallInt64":"-9223372036854775807","#
1338
- + #""utf8String":"ሴ","#
1339
- + #""zeroFloat":0.0,"#
1340
- + #""oneFloat":1.0,"#
1341
- + #""smallFloat":1.5,"#
1342
- + #""negativeOneFloat":-1.0,"#
1343
- + #""negativeFloat":-1.5,"#
1344
- + #""largeFloat":2e+08,"#
1345
- + #""smallNegativeFloat":-8e-28,"#
1346
- + #""infDouble":"Infinity","#
1347
- + #""negInfDouble":"-Infinity","#
1348
- // TODO: NaN and Inifinity should fall back to 0 like they do in C++
1349
- + #""nanDouble":"NaN","#
1350
- + #""infFloat":"Infinity","#
1351
- + #""negInfFloat":"-Infinity","#
1352
- + #""nanFloat":"NaN","#
1353
- + #""cppTrigraph":"? ? ?? ?? ??? ??/ ??-","#
1354
- + #""reallySmallInt32":-2147483648,"#
1355
- + #""reallySmallInt64":"-9223372036854775808","#
1356
- + #""stringWithZero":"hel\u0000lo","#
1357
- + #""bytesWithZero":"d29yAGxk","#
1358
- + #""stringPieceWithZero":"ab\u0000c","#
1359
- + #""cordWithZero":"12\u00003","#
1360
- + #""replacementString":"${unknown}""#
1361
- + " } "
1362
-
1254
+ let expected = " {} "
1363
1255
var encodingOptions = JSONEncodingOptions ( )
1364
1256
encodingOptions. alwaysPrintPrimitiveFields = true
1365
1257
let msg = SwiftProtoTesting_TestExtremeDefaultValues ( )
0 commit comments