Skip to content

Commit fe91765

Browse files
committed
Other: Updated tests to use new simplified encoder logic
1 parent da6af81 commit fe91765

File tree

10 files changed

+269
-285
lines changed

10 files changed

+269
-285
lines changed

cli/targets/static.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ function buildType(ref, type) {
288288
type.comment ? "@classdesc " + type.comment : null,
289289
"@exports " + fullName,
290290
"@constructor",
291-
"@param {Object} [" + (config.beautify ? "properties" : "p") + "] Properties to set"
291+
"@param {Object.<string,*>=} [" + (config.beautify ? "properties" : "p") + "] Properties to set"
292292
]);
293293
buildFunction(type, type.name, Class.generate(type));
294294

@@ -380,7 +380,7 @@ function buildType(ref, type) {
380380
push("");
381381
pushComment([
382382
"Creates a new " + type.name + " instance using the specified properties.",
383-
"@param {Object} [properties] Properties to set",
383+
"@param {Object.<string,*>=} [properties] Properties to set",
384384
"@returns {" + fullName + "} " + type.name + " instance"
385385
]);
386386
push(name(type.name) + ".create = function create(properties) {");

src/util/minimal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ util.lazyResolve = function lazyResolve(root, lazyTypes) {
328328
};
329329

330330
/**
331-
* Default conversion options used for toJSON implementations. Converts longs, enums and bytes to strings.
331+
* Default conversion options used for {@link Message#toJSON} implementations. Longs, enums and bytes are converted to strings by default.
332332
* @type {ConversionOptions}
333333
*/
334334
util.toJSONOptions = {

tests/data/comments.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ $root.Test1 = (function() {
2222
* comment.
2323
* @exports Test1
2424
* @constructor
25-
* @param {Object} [properties] Properties to set
25+
* @param {Object.<string,*>=} [properties] Properties to set
2626
*/
2727
function Test1(properties) {
2828
if (properties)
@@ -50,7 +50,7 @@ $root.Test1 = (function() {
5050

5151
/**
5252
* Creates a new Test1 instance using the specified properties.
53-
* @param {Object} [properties] Properties to set
53+
* @param {Object.<string,*>=} [properties] Properties to set
5454
* @returns {Test1} Test1 instance
5555
*/
5656
Test1.create = function create(properties) {
@@ -227,7 +227,7 @@ $root.Test2 = (function() {
227227
* Constructs a new Test2.
228228
* @exports Test2
229229
* @constructor
230-
* @param {Object} [properties] Properties to set
230+
* @param {Object.<string,*>=} [properties] Properties to set
231231
*/
232232
function Test2(properties) {
233233
if (properties)
@@ -237,7 +237,7 @@ $root.Test2 = (function() {
237237

238238
/**
239239
* Creates a new Test2 instance using the specified properties.
240-
* @param {Object} [properties] Properties to set
240+
* @param {Object.<string,*>=} [properties] Properties to set
241241
* @returns {Test2} Test2 instance
242242
*/
243243
Test2.create = function create(properties) {

tests/data/convert.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $root.Message = (function() {
1818
* Constructs a new Message.
1919
* @exports Message
2020
* @constructor
21-
* @param {Object} [properties] Properties to set
21+
* @param {Object.<string,*>=} [properties] Properties to set
2222
*/
2323
function Message(properties) {
2424
if (properties)
@@ -88,7 +88,7 @@ $root.Message = (function() {
8888

8989
/**
9090
* Creates a new Message instance using the specified properties.
91-
* @param {Object} [properties] Properties to set
91+
* @param {Object.<string,*>=} [properties] Properties to set
9292
* @returns {Message} Message instance
9393
*/
9494
Message.create = function create(properties) {

tests/data/mapbox/vector_tile.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ $root.vector_tile = (function() {
2727
* Constructs a new Tile.
2828
* @exports vector_tile.Tile
2929
* @constructor
30-
* @param {Object} [properties] Properties to set
30+
* @param {Object.<string,*>=} [properties] Properties to set
3131
*/
3232
function Tile(properties) {
3333
if (properties)
@@ -48,7 +48,7 @@ $root.vector_tile = (function() {
4848

4949
/**
5050
* Creates a new Tile instance using the specified properties.
51-
* @param {Object} [properties] Properties to set
51+
* @param {Object.<string,*>=} [properties] Properties to set
5252
* @returns {vector_tile.Tile} Tile instance
5353
*/
5454
Tile.create = function create(properties) {
@@ -234,7 +234,7 @@ $root.vector_tile = (function() {
234234
* Constructs a new Value.
235235
* @exports vector_tile.Tile.Value
236236
* @constructor
237-
* @param {Object} [properties] Properties to set
237+
* @param {Object.<string,*>=} [properties] Properties to set
238238
*/
239239
function Value(properties) {
240240
if (properties)
@@ -286,7 +286,7 @@ $root.vector_tile = (function() {
286286

287287
/**
288288
* Creates a new Value instance using the specified properties.
289-
* @param {Object} [properties] Properties to set
289+
* @param {Object.<string,*>=} [properties] Properties to set
290290
* @returns {vector_tile.Tile.Value} Value instance
291291
*/
292292
Value.create = function create(properties) {
@@ -557,7 +557,7 @@ $root.vector_tile = (function() {
557557
* Constructs a new Feature.
558558
* @exports vector_tile.Tile.Feature
559559
* @constructor
560-
* @param {Object} [properties] Properties to set
560+
* @param {Object.<string,*>=} [properties] Properties to set
561561
*/
562562
function Feature(properties) {
563563
if (properties)
@@ -596,7 +596,7 @@ $root.vector_tile = (function() {
596596

597597
/**
598598
* Creates a new Feature instance using the specified properties.
599-
* @param {Object} [properties] Properties to set
599+
* @param {Object.<string,*>=} [properties] Properties to set
600600
* @returns {vector_tile.Tile.Feature} Feature instance
601601
*/
602602
Feature.create = function create(properties) {
@@ -871,7 +871,7 @@ $root.vector_tile = (function() {
871871
* Constructs a new Layer.
872872
* @exports vector_tile.Tile.Layer
873873
* @constructor
874-
* @param {Object} [properties] Properties to set
874+
* @param {Object.<string,*>=} [properties] Properties to set
875875
*/
876876
function Layer(properties) {
877877
if (properties)
@@ -923,7 +923,7 @@ $root.vector_tile = (function() {
923923

924924
/**
925925
* Creates a new Layer instance using the specified properties.
926-
* @param {Object} [properties] Properties to set
926+
* @param {Object.<string,*>=} [properties] Properties to set
927927
* @returns {vector_tile.Tile.Layer} Layer instance
928928
*/
929929
Layer.create = function create(properties) {

tests/data/package.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $root.Package = (function() {
1818
* Constructs a new Package.
1919
* @exports Package
2020
* @constructor
21-
* @param {Object} [properties] Properties to set
21+
* @param {Object.<string,*>=} [properties] Properties to set
2222
*/
2323
function Package(properties) {
2424
if (properties)
@@ -141,7 +141,7 @@ $root.Package = (function() {
141141

142142
/**
143143
* Creates a new Package instance using the specified properties.
144-
* @param {Object} [properties] Properties to set
144+
* @param {Object.<string,*>=} [properties] Properties to set
145145
* @returns {Package} Package instance
146146
*/
147147
Package.create = function create(properties) {
@@ -644,7 +644,7 @@ $root.Package = (function() {
644644
* Constructs a new Repository.
645645
* @exports Package.Repository
646646
* @constructor
647-
* @param {Object} [properties] Properties to set
647+
* @param {Object.<string,*>=} [properties] Properties to set
648648
*/
649649
function Repository(properties) {
650650
if (properties)
@@ -666,7 +666,7 @@ $root.Package = (function() {
666666

667667
/**
668668
* Creates a new Repository instance using the specified properties.
669-
* @param {Object} [properties] Properties to set
669+
* @param {Object.<string,*>=} [properties] Properties to set
670670
* @returns {Package.Repository} Repository instance
671671
*/
672672
Repository.create = function create(properties) {

tests/data/rpc.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ export class MyService extends $protobuf.rpc.Service {
1010
type MyService_myMethod_Callback = (error: Error, response?: MyResponse) => void;
1111

1212
export class MyRequest {
13-
constructor(properties?: Object);
13+
constructor(properties?: { [k: string]: any });
1414
public path?: string;
15-
public static create(properties?: Object): MyRequest;
15+
public static create(properties?: { [k: string]: any }): MyRequest;
1616
public static encode(message: (MyRequest|Object), writer?: $protobuf.Writer): $protobuf.Writer;
1717
public static encodeDelimited(message: (MyRequest|Object), writer?: $protobuf.Writer): $protobuf.Writer;
1818
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): MyRequest;
@@ -26,9 +26,9 @@ export class MyRequest {
2626
}
2727

2828
export class MyResponse {
29-
constructor(properties?: Object);
29+
constructor(properties?: { [k: string]: any });
3030
public status?: number;
31-
public static create(properties?: Object): MyResponse;
31+
public static create(properties?: { [k: string]: any }): MyResponse;
3232
public static encode(message: (MyResponse|Object), writer?: $protobuf.Writer): $protobuf.Writer;
3333
public static encodeDelimited(message: (MyResponse|Object), writer?: $protobuf.Writer): $protobuf.Writer;
3434
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): MyResponse;

tests/data/rpc.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ $root.MyRequest = (function() {
7676
* Constructs a new MyRequest.
7777
* @exports MyRequest
7878
* @constructor
79-
* @param {Object} [properties] Properties to set
79+
* @param {Object.<string,*>=} [properties] Properties to set
8080
*/
8181
function MyRequest(properties) {
8282
if (properties)
@@ -92,7 +92,7 @@ $root.MyRequest = (function() {
9292

9393
/**
9494
* Creates a new MyRequest instance using the specified properties.
95-
* @param {Object} [properties] Properties to set
95+
* @param {Object.<string,*>=} [properties] Properties to set
9696
* @returns {MyRequest} MyRequest instance
9797
*/
9898
MyRequest.create = function create(properties) {
@@ -242,7 +242,7 @@ $root.MyResponse = (function() {
242242
* Constructs a new MyResponse.
243243
* @exports MyResponse
244244
* @constructor
245-
* @param {Object} [properties] Properties to set
245+
* @param {Object.<string,*>=} [properties] Properties to set
246246
*/
247247
function MyResponse(properties) {
248248
if (properties)
@@ -258,7 +258,7 @@ $root.MyResponse = (function() {
258258

259259
/**
260260
* Creates a new MyResponse instance using the specified properties.
261-
* @param {Object} [properties] Properties to set
261+
* @param {Object.<string,*>=} [properties] Properties to set
262262
* @returns {MyResponse} MyResponse instance
263263
*/
264264
MyResponse.create = function create(properties) {

0 commit comments

Comments
 (0)