| Index: third_party/protobuf/js/proto3_test.js
|
| diff --git a/third_party/protobuf/js/proto3_test.js b/third_party/protobuf/js/proto3_test.js
|
| index 81d6de2f5eeec162df8a7bd847ad42b0b7666ee5..4dd7790f16b9427128f62bf5c04325ce0e5378f4 100644
|
| --- a/third_party/protobuf/js/proto3_test.js
|
| +++ b/third_party/protobuf/js/proto3_test.js
|
| @@ -38,12 +38,6 @@ goog.require('proto.jspb.test.ForeignMessage');
|
| goog.require('proto.jspb.test.Proto3Enum');
|
| goog.require('proto.jspb.test.TestProto3');
|
|
|
| -// CommonJS-LoadFromFile: google/protobuf/timestamp_pb proto.google.protobuf
|
| -goog.require('proto.google.protobuf.Timestamp');
|
| -
|
| -// CommonJS-LoadFromFile: google/protobuf/struct_pb proto.google.protobuf
|
| -goog.require('proto.google.protobuf.Struct');
|
| -
|
|
|
| var BYTES = new Uint8Array([1, 2, 8, 9]);
|
| var BYTES_B64 = goog.crypt.base64.encodeByteArray(BYTES);
|
| @@ -227,52 +221,37 @@ describe('proto3Test', function() {
|
| it('testOneofs', function() {
|
| var msg = new proto.jspb.test.TestProto3();
|
|
|
| - assertEquals(msg.getOneofUint32(), 0);
|
| + assertEquals(msg.getOneofUint32(), undefined);
|
| assertEquals(msg.getOneofForeignMessage(), undefined);
|
| - assertEquals(msg.getOneofString(), '');
|
| - assertEquals(msg.getOneofBytes(), '');
|
| - assertFalse(msg.hasOneofUint32());
|
| - assertFalse(msg.hasOneofString());
|
| - assertFalse(msg.hasOneofBytes());
|
| + assertEquals(msg.getOneofString(), undefined);
|
| + assertEquals(msg.getOneofBytes(), undefined);
|
|
|
| msg.setOneofUint32(42);
|
| assertEquals(msg.getOneofUint32(), 42);
|
| assertEquals(msg.getOneofForeignMessage(), undefined);
|
| - assertEquals(msg.getOneofString(), '');
|
| - assertEquals(msg.getOneofBytes(), '');
|
| - assertTrue(msg.hasOneofUint32());
|
| - assertFalse(msg.hasOneofString());
|
| - assertFalse(msg.hasOneofBytes());
|
| + assertEquals(msg.getOneofString(), undefined);
|
| + assertEquals(msg.getOneofBytes(), undefined);
|
|
|
|
|
| var submsg = new proto.jspb.test.ForeignMessage();
|
| msg.setOneofForeignMessage(submsg);
|
| - assertEquals(msg.getOneofUint32(), 0);
|
| + assertEquals(msg.getOneofUint32(), undefined);
|
| assertEquals(msg.getOneofForeignMessage(), submsg);
|
| - assertEquals(msg.getOneofString(), '');
|
| - assertEquals(msg.getOneofBytes(), '');
|
| - assertFalse(msg.hasOneofUint32());
|
| - assertFalse(msg.hasOneofString());
|
| - assertFalse(msg.hasOneofBytes());
|
| + assertEquals(msg.getOneofString(), undefined);
|
| + assertEquals(msg.getOneofBytes(), undefined);
|
|
|
| msg.setOneofString('hello');
|
| - assertEquals(msg.getOneofUint32(), 0);
|
| + assertEquals(msg.getOneofUint32(), undefined);
|
| assertEquals(msg.getOneofForeignMessage(), undefined);
|
| assertEquals(msg.getOneofString(), 'hello');
|
| - assertEquals(msg.getOneofBytes(), '');
|
| - assertFalse(msg.hasOneofUint32());
|
| - assertTrue(msg.hasOneofString());
|
| - assertFalse(msg.hasOneofBytes());
|
| + assertEquals(msg.getOneofBytes(), undefined);
|
|
|
| msg.setOneofBytes(goog.crypt.base64.encodeString('\u00FF\u00FF'));
|
| - assertEquals(msg.getOneofUint32(), 0);
|
| + assertEquals(msg.getOneofUint32(), undefined);
|
| assertEquals(msg.getOneofForeignMessage(), undefined);
|
| - assertEquals(msg.getOneofString(), '');
|
| + assertEquals(msg.getOneofString(), undefined);
|
| assertEquals(msg.getOneofBytes_asB64(),
|
| goog.crypt.base64.encodeString('\u00FF\u00FF'));
|
| - assertFalse(msg.hasOneofUint32());
|
| - assertFalse(msg.hasOneofString());
|
| - assertTrue(msg.hasOneofBytes());
|
| });
|
|
|
|
|
| @@ -300,7 +279,7 @@ describe('proto3Test', function() {
|
| msg.setOptionalForeignEnum(proto.jspb.test.Proto3Enum.PROTO3_BAR);
|
| msg.setOptionalForeignEnum(proto.jspb.test.Proto3Enum.PROTO3_FOO);
|
| msg.setOneofUint32(32);
|
| - msg.clearOneofUint32();
|
| + msg.setOneofUint32(null);
|
|
|
|
|
| var serialized = msg.serializeBinary();
|
| @@ -332,36 +311,4 @@ describe('proto3Test', function() {
|
| assertTrue(bytesCompare(msg.getOptionalBytes(), BYTES));
|
|
|
| });
|
| -
|
| - it('testTimestampWellKnownType', function() {
|
| - var msg = new proto.google.protobuf.Timestamp();
|
| - msg.fromDate(new Date(123456789));
|
| - assertEquals(123456, msg.getSeconds());
|
| - assertEquals(789000000, msg.getNanos());
|
| - var date = msg.toDate();
|
| - assertEquals(123456789, date.getTime());
|
| - });
|
| -
|
| - it('testStructWellKnownType', function() {
|
| - var jsObj = {
|
| - abc: "def",
|
| - number: 12345.678,
|
| - nullKey: null,
|
| - boolKey: true,
|
| - listKey: [1, null, true, false, "abc"],
|
| - structKey: {foo: "bar", somenum: 123},
|
| - complicatedKey: [{xyz: {abc: [3, 4, null, false]}}, "zzz"]
|
| - };
|
| -
|
| - var struct = proto.google.protobuf.Struct.fromJavaScript(jsObj);
|
| - var jsObj2 = struct.toJavaScript();
|
| -
|
| - assertEquals("def", jsObj2.abc);
|
| - assertEquals(12345.678, jsObj2.number);
|
| - assertEquals(null, jsObj2.nullKey);
|
| - assertEquals(true, jsObj2.boolKey);
|
| - assertEquals("abc", jsObj2.listKey[4]);
|
| - assertEquals("bar", jsObj2.structKey.foo);
|
| - assertEquals(4, jsObj2.complicatedKey[0].xyz.abc[1]);
|
| - });
|
| });
|
|
|