diff --git a/src/tokenize.js b/src/tokenize.js index 3be27e41f..bc0b3b4fc 100644 --- a/src/tokenize.js +++ b/src/tokenize.js @@ -305,7 +305,8 @@ function tokenize(source) { if (commentLine === line - 1 && (commentType === "*" || commentLineEmpty)) ret = commentText; } else { - if (commentLine !== trailingLine || commentLineEmpty || commentType !== "/") + /* istanbul ignore else */ + if (commentLine < trailingLine) peek(); if (commentLine === trailingLine && !commentLineEmpty && commentType === "/") ret = commentText; diff --git a/tests/api_common.js b/tests/api_common.js index 273edd6c2..fba6813cf 100644 --- a/tests/api_common.js +++ b/tests/api_common.js @@ -21,5 +21,7 @@ tape.test("common types", function(test) { }); test.ok(protobuf.common["google/protobuf/foo.proto"], "should expose custom definitions"); + test.same(protobuf.common.get("google/protobuf/any.proto"), protobuf.common["google/protobuf/any.proto"], "should also get() any definition"); + test.equal(protobuf.common.get("google/protobuf/doesntexist.proto"), null, "should return null from get() if there is no such definition"); test.end(); }); \ No newline at end of file diff --git a/tests/comp_google_protobuf_any.js b/tests/comp_google_protobuf_any.js index f10fc5ba3..eb57455ad 100644 --- a/tests/comp_google_protobuf_any.js +++ b/tests/comp_google_protobuf_any.js @@ -51,7 +51,11 @@ tape.test("google.protobuf.Any", function(test) { } }); test.ok(foo.foo instanceof Any.ctor, "should convert to Any in fromObject"); - test.same(foo.foo, { type_url: ".Bar", value: [10, 1, 97] }, "should have correct Any object when converted with fromObject"); + var comp = protobuf.util.newBuffer(3); + comp[0] = 10; + comp[1] = 1; + comp[2] = 97; + test.same(foo.foo, { type_url: ".Bar", value: comp }, "should have correct Any object when converted with fromObject"); test.end(); });