Skip to content

Commit b49a4ed

Browse files
committed
Other: Fixed failing test case + coverage
1 parent b596607 commit b49a4ed

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

src/tokenize.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@ function tokenize(source) {
305305
if (commentLine === line - 1 && (commentType === "*" || commentLineEmpty))
306306
ret = commentText;
307307
} else {
308-
if (commentLine !== trailingLine || commentLineEmpty || commentType !== "/")
308+
/* istanbul ignore else */
309+
if (commentLine < trailingLine)
309310
peek();
310311
if (commentLine === trailingLine && !commentLineEmpty && commentType === "/")
311312
ret = commentText;

tests/api_common.js

+2
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,7 @@ tape.test("common types", function(test) {
2121
});
2222

2323
test.ok(protobuf.common["google/protobuf/foo.proto"], "should expose custom definitions");
24+
test.same(protobuf.common.get("google/protobuf/any.proto"), protobuf.common["google/protobuf/any.proto"], "should also get() any definition");
25+
test.equal(protobuf.common.get("google/protobuf/doesntexist.proto"), null, "should return null from get() if there is no such definition");
2426
test.end();
2527
});

tests/comp_google_protobuf_any.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ tape.test("google.protobuf.Any", function(test) {
5151
}
5252
});
5353
test.ok(foo.foo instanceof Any.ctor, "should convert to Any in fromObject");
54-
test.same(foo.foo, { type_url: ".Bar", value: [10, 1, 97] }, "should have correct Any object when converted with fromObject");
54+
var comp = protobuf.util.newBuffer(3);
55+
comp[0] = 10;
56+
comp[1] = 1;
57+
comp[2] = 97;
58+
test.same(foo.foo, { type_url: ".Bar", value: comp }, "should have correct Any object when converted with fromObject");
5559

5660
test.end();
5761
});

0 commit comments

Comments
 (0)