Sha256: aacc2755f73f0110341745246a19c1065d73ed23909d86ad0d3547f53c3961fc

Contents?: true

Size: 1.27 KB

Versions: 27

Compression:

Stored size: 1.27 KB

Contents

// this are dev dependencies
var diff = require("jest-diff");

var _require = require("jest-diff/build/constants"),
    NO_DIFF_MESSAGE = _require.NO_DIFF_MESSAGE;

var _require2 = require("@webassemblyjs/wasm-parser"),
    decode = _require2.decode;

var oldConsoleLog = console.log;
export function compareArrayBuffers(l, r) {
  /**
   * Decode left
   */
  var bufferL = "";

  console.log = function () {
    for (var _len = arguments.length, texts = new Array(_len), _key = 0; _key < _len; _key++) {
      texts[_key] = arguments[_key];
    }

    return bufferL += texts.join("") + "\n";
  };

  try {
    decode(l, {
      dump: true
    });
  } catch (e) {
    console.error(bufferL);
    console.error(e);
    throw e;
  }
  /**
   * Decode right
   */


  var bufferR = "";

  console.log = function () {
    for (var _len2 = arguments.length, texts = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
      texts[_key2] = arguments[_key2];
    }

    return bufferR += texts.join("") + "\n";
  };

  try {
    decode(r, {
      dump: true
    });
  } catch (e) {
    console.error(bufferR);
    console.error(e);
    throw e;
  }

  console.log = oldConsoleLog;
  var out = diff(bufferL, bufferR);

  if (out !== null && out !== NO_DIFF_MESSAGE) {
    throw new Error("\n" + out);
  }
}

Version data entries

27 entries across 26 versions & 9 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/@webassemblyjs/helper-buffer/esm/compare.js
disco_app-0.18.0 test/dummy/node_modules/@webassemblyjs/helper-buffer/esm/compare.js
disco_app-0.18.2 test/dummy/node_modules/@webassemblyjs/helper-buffer/esm/compare.js
disco_app-0.16.1 test/dummy/node_modules/@webassemblyjs/helper-buffer/esm/compare.js
disco_app-0.15.2 test/dummy/node_modules/@webassemblyjs/helper-buffer/esm/compare.js
disco_app-0.18.4 test/dummy/node_modules/@webassemblyjs/helper-buffer/esm/compare.js
disco_app-0.18.1 test/dummy/node_modules/@webassemblyjs/helper-buffer/esm/compare.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/@webassemblyjs/helper-buffer/esm/compare.js
disco_app-0.14.0 test/dummy/node_modules/@webassemblyjs/helper-buffer/esm/compare.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/@webassemblyjs/helper-buffer/esm/compare.js
tang-0.2.1 spec/tang_app/node_modules/@webassemblyjs/helper-buffer/esm/compare.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/@webassemblyjs/helper-buffer/esm/compare.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/@webassemblyjs/helper-buffer/esm/compare.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/@webassemblyjs/helper-buffer/esm/compare.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/@webassemblyjs/helper-buffer/esm/compare.js
tang-0.2.0 spec/tang_app/node_modules/@webassemblyjs/helper-buffer/esm/compare.js
tang-0.1.0 spec/tang_app/node_modules/@webassemblyjs/helper-buffer/esm/compare.js
tang-0.0.9 spec/tang_app/node_modules/@webassemblyjs/helper-buffer/esm/compare.js
enju_library-0.3.8 spec/dummy/node_modules/@webassemblyjs/helper-buffer/esm/compare.js
jester-data-8.0.0 node_modules/@webassemblyjs/helper-buffer/esm/compare.js