Skip to content

Commit 3a48675

Browse files
authored
fix: Forward group end tag in lazy decode (#2162)
1 parent 6eb3a3b commit 3a48675

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

tests/comp_groups.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ tape.test("legacy groups", function(test) {
3939
// NOTE: fromJSON alone does not add the sister-field.
4040
// The parser does this explicitly and the field is part of the exported JSON itself.
4141

42+
test.test(test.name + " - should decode without prior setup", (function(Test, msg) { return function(test) {
43+
// Use a fixed buffer so encode() does not set up the nested group decoder first
44+
var buf = protobuf.util.newBuffer([1 << 3 | 3, 2 << 3 | 0, 111, 1 << 3 | 4]);
45+
test.same(Test.decode(buf), msg, "and decode back the original message");
46+
test.end();
47+
};})(Test, msg));
48+
4249
test.test(test.name + " - should encode required", (function(Test, msg) { return function(test) {
4350
var buf = Test.encode(msg).finish();
4451
test.equal(buf.length, 4, "a total of 4 bytes");

0 commit comments

Comments
 (0)