1 /*eslint-disable no-console*/
3 var protobuf = require("../../"),
4 descriptor = require(".");
30 // var root = protobuf.Root.fromJSON(proto).resolveAll();
31 var root = protobuf.loadSync("tests/data/google/protobuf/descriptor.proto").resolveAll();
33 // console.log("Original proto", JSON.stringify(root, null, 2));
35 var msg = root.toDescriptor();
37 // console.log("\nDescriptor", JSON.stringify(msg.toObject(), null, 2));
39 var buf = descriptor.FileDescriptorSet.encode(msg).finish();
40 var root2 = protobuf.Root.fromDescriptor(buf, "proto2").resolveAll();
42 // console.log("\nDecoded proto", JSON.stringify(root2, null, 2));
44 var diff = require("deep-diff").diff(root.toJSON(), root2.toJSON());
46 diff.forEach(function(diff) {
47 console.log(diff.kind + " @ " + diff.path.join("."));
48 console.log("lhs:", typeof diff.lhs, diff.lhs);
49 console.log("rhs:", typeof diff.rhs, diff.rhs);
54 console.log("no differences");