Skip to content

Commit

Permalink
Other: Fixed failing test case + coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Apr 20, 2017
1 parent b596607 commit b49a4ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/tokenize.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions tests/api_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
6 changes: 5 additions & 1 deletion tests/comp_google_protobuf_any.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

0 comments on commit b49a4ed

Please sign in to comment.