File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " protobufjs" ,
3- "version" : " 6.1.1 " ,
3+ "version" : " 6.1.2 " ,
44 "description" : " Protocol Buffers for JavaScript (& TypeScript)." ,
55 "author" : " Daniel Wirtz <dcode+protobufjs@dcode.io>" ,
66 "license" : " Apache-2.0" ,
Original file line number Diff line number Diff line change 1+ var tape = require ( "tape" ) ;
2+
3+ var protobuf = require ( ".." ) ;
4+
5+ var root = protobuf . Root . fromJSON ( {
6+ nested : {
7+ Message : {
8+ fields : {
9+ val : {
10+ type : "uint32" ,
11+ id : 0x1FFFFFFF
12+ }
13+ }
14+ }
15+ }
16+ } ) ;
17+
18+ tape . test ( "long tags" , function ( test ) {
19+
20+ var Message = root . lookup ( "Message" ) ;
21+ var message = { val : 1 } ;
22+ var buf = Message . encode ( message ) . finish ( ) ;
23+
24+ test . equal ( buf [ 0 ] , 0xF8 , "should write F8 (78)" ) ;
25+ test . equal ( buf [ 1 ] , 0xff , "should write FF (7F)" ) ;
26+ test . equal ( buf [ 2 ] , 0xff , "should write FF (7F)" ) ;
27+ test . equal ( buf [ 3 ] , 0xff , "should write FF (7F)" ) ;
28+ test . equal ( buf [ 4 ] , 0b1111 , "should write 1111b" ) ;
29+ test . equal ( buf [ 5 ] , 1 , "should write value 1" ) ;
30+
31+ var comp = Message . decode ( buf ) ;
32+ test . deepEqual ( comp , message , "should decode back the original data" ) ;
33+
34+ test . end ( ) ;
35+ } ) ;
You can’t perform that action at this time.
0 commit comments