Skip to content

Commit

Permalink
Other: Updated tests to use new simplified encoder logic
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Mar 20, 2017
1 parent da6af81 commit fe91765
Show file tree
Hide file tree
Showing 10 changed files with 269 additions and 285 deletions.
4 changes: 2 additions & 2 deletions cli/targets/static.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ function buildType(ref, type) {
type.comment ? "@classdesc " + type.comment : null,
"@exports " + fullName,
"@constructor",
"@param {Object} [" + (config.beautify ? "properties" : "p") + "] Properties to set"
"@param {Object.<string,*>=} [" + (config.beautify ? "properties" : "p") + "] Properties to set"
]);
buildFunction(type, type.name, Class.generate(type));

Expand Down Expand Up @@ -380,7 +380,7 @@ function buildType(ref, type) {
push("");
pushComment([
"Creates a new " + type.name + " instance using the specified properties.",
"@param {Object} [properties] Properties to set",
"@param {Object.<string,*>=} [properties] Properties to set",
"@returns {" + fullName + "} " + type.name + " instance"
]);
push(name(type.name) + ".create = function create(properties) {");
Expand Down
2 changes: 1 addition & 1 deletion src/util/minimal.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ util.lazyResolve = function lazyResolve(root, lazyTypes) {
};

/**
* Default conversion options used for toJSON implementations. Converts longs, enums and bytes to strings.
* Default conversion options used for {@link Message#toJSON} implementations. Longs, enums and bytes are converted to strings by default.
* @type {ConversionOptions}
*/
util.toJSONOptions = {
Expand Down
8 changes: 4 additions & 4 deletions tests/data/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ $root.Test1 = (function() {
* comment.
* @exports Test1
* @constructor
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
*/
function Test1(properties) {
if (properties)
Expand Down Expand Up @@ -50,7 +50,7 @@ $root.Test1 = (function() {

/**
* Creates a new Test1 instance using the specified properties.
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
* @returns {Test1} Test1 instance
*/
Test1.create = function create(properties) {
Expand Down Expand Up @@ -227,7 +227,7 @@ $root.Test2 = (function() {
* Constructs a new Test2.
* @exports Test2
* @constructor
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
*/
function Test2(properties) {
if (properties)
Expand All @@ -237,7 +237,7 @@ $root.Test2 = (function() {

/**
* Creates a new Test2 instance using the specified properties.
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
* @returns {Test2} Test2 instance
*/
Test2.create = function create(properties) {
Expand Down
4 changes: 2 additions & 2 deletions tests/data/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $root.Message = (function() {
* Constructs a new Message.
* @exports Message
* @constructor
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
*/
function Message(properties) {
if (properties)
Expand Down Expand Up @@ -88,7 +88,7 @@ $root.Message = (function() {

/**
* Creates a new Message instance using the specified properties.
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
* @returns {Message} Message instance
*/
Message.create = function create(properties) {
Expand Down
16 changes: 8 additions & 8 deletions tests/data/mapbox/vector_tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ $root.vector_tile = (function() {
* Constructs a new Tile.
* @exports vector_tile.Tile
* @constructor
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
*/
function Tile(properties) {
if (properties)
Expand All @@ -48,7 +48,7 @@ $root.vector_tile = (function() {

/**
* Creates a new Tile instance using the specified properties.
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
* @returns {vector_tile.Tile} Tile instance
*/
Tile.create = function create(properties) {
Expand Down Expand Up @@ -234,7 +234,7 @@ $root.vector_tile = (function() {
* Constructs a new Value.
* @exports vector_tile.Tile.Value
* @constructor
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
*/
function Value(properties) {
if (properties)
Expand Down Expand Up @@ -286,7 +286,7 @@ $root.vector_tile = (function() {

/**
* Creates a new Value instance using the specified properties.
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
* @returns {vector_tile.Tile.Value} Value instance
*/
Value.create = function create(properties) {
Expand Down Expand Up @@ -557,7 +557,7 @@ $root.vector_tile = (function() {
* Constructs a new Feature.
* @exports vector_tile.Tile.Feature
* @constructor
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
*/
function Feature(properties) {
if (properties)
Expand Down Expand Up @@ -596,7 +596,7 @@ $root.vector_tile = (function() {

/**
* Creates a new Feature instance using the specified properties.
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
* @returns {vector_tile.Tile.Feature} Feature instance
*/
Feature.create = function create(properties) {
Expand Down Expand Up @@ -871,7 +871,7 @@ $root.vector_tile = (function() {
* Constructs a new Layer.
* @exports vector_tile.Tile.Layer
* @constructor
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
*/
function Layer(properties) {
if (properties)
Expand Down Expand Up @@ -923,7 +923,7 @@ $root.vector_tile = (function() {

/**
* Creates a new Layer instance using the specified properties.
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
* @returns {vector_tile.Tile.Layer} Layer instance
*/
Layer.create = function create(properties) {
Expand Down
8 changes: 4 additions & 4 deletions tests/data/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $root.Package = (function() {
* Constructs a new Package.
* @exports Package
* @constructor
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
*/
function Package(properties) {
if (properties)
Expand Down Expand Up @@ -141,7 +141,7 @@ $root.Package = (function() {

/**
* Creates a new Package instance using the specified properties.
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
* @returns {Package} Package instance
*/
Package.create = function create(properties) {
Expand Down Expand Up @@ -644,7 +644,7 @@ $root.Package = (function() {
* Constructs a new Repository.
* @exports Package.Repository
* @constructor
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
*/
function Repository(properties) {
if (properties)
Expand All @@ -666,7 +666,7 @@ $root.Package = (function() {

/**
* Creates a new Repository instance using the specified properties.
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
* @returns {Package.Repository} Repository instance
*/
Repository.create = function create(properties) {
Expand Down
8 changes: 4 additions & 4 deletions tests/data/rpc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export class MyService extends $protobuf.rpc.Service {
type MyService_myMethod_Callback = (error: Error, response?: MyResponse) => void;

export class MyRequest {
constructor(properties?: Object);
constructor(properties?: { [k: string]: any });
public path?: string;
public static create(properties?: Object): MyRequest;
public static create(properties?: { [k: string]: any }): MyRequest;
public static encode(message: (MyRequest|Object), writer?: $protobuf.Writer): $protobuf.Writer;
public static encodeDelimited(message: (MyRequest|Object), writer?: $protobuf.Writer): $protobuf.Writer;
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): MyRequest;
Expand All @@ -26,9 +26,9 @@ export class MyRequest {
}

export class MyResponse {
constructor(properties?: Object);
constructor(properties?: { [k: string]: any });
public status?: number;
public static create(properties?: Object): MyResponse;
public static create(properties?: { [k: string]: any }): MyResponse;
public static encode(message: (MyResponse|Object), writer?: $protobuf.Writer): $protobuf.Writer;
public static encodeDelimited(message: (MyResponse|Object), writer?: $protobuf.Writer): $protobuf.Writer;
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): MyResponse;
Expand Down
8 changes: 4 additions & 4 deletions tests/data/rpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ $root.MyRequest = (function() {
* Constructs a new MyRequest.
* @exports MyRequest
* @constructor
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
*/
function MyRequest(properties) {
if (properties)
Expand All @@ -92,7 +92,7 @@ $root.MyRequest = (function() {

/**
* Creates a new MyRequest instance using the specified properties.
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
* @returns {MyRequest} MyRequest instance
*/
MyRequest.create = function create(properties) {
Expand Down Expand Up @@ -242,7 +242,7 @@ $root.MyResponse = (function() {
* Constructs a new MyResponse.
* @exports MyResponse
* @constructor
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
*/
function MyResponse(properties) {
if (properties)
Expand All @@ -258,7 +258,7 @@ $root.MyResponse = (function() {

/**
* Creates a new MyResponse instance using the specified properties.
* @param {Object} [properties] Properties to set
* @param {Object.<string,*>=} [properties] Properties to set
* @returns {MyResponse} MyResponse instance
*/
MyResponse.create = function create(properties) {
Expand Down
Loading

0 comments on commit fe91765

Please sign in to comment.