mirror of
https://github.com/denoland/deno.git
synced 2024-11-30 16:40:57 -05:00
6915a9b7a7
This PR adds the remaining ~650 Node.js compat test cases from std/node. Among these 650 cases, about 130 cases are now failing. These failing cases are prefixed with `TODO:` in `tests/node_compat/config.json`. These will be addressed in later PRs.
32 lines
881 B
JavaScript
32 lines
881 B
JavaScript
// deno-fmt-ignore-file
|
|
// deno-lint-ignore-file
|
|
|
|
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
|
// Taken from Node 18.12.1
|
|
// This file is automatically generated by "node/_tools/setup.ts". Do not modify this file manually
|
|
|
|
'use strict';
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
|
|
const b = Buffer.from('abcdf');
|
|
const c = Buffer.from('abcdf');
|
|
const d = Buffer.from('abcde');
|
|
const e = Buffer.from('abcdef');
|
|
|
|
assert.ok(b.equals(c));
|
|
assert.ok(!c.equals(d));
|
|
assert.ok(!d.equals(e));
|
|
assert.ok(d.equals(d));
|
|
assert.ok(d.equals(new Uint8Array([0x61, 0x62, 0x63, 0x64, 0x65])));
|
|
|
|
assert.throws(
|
|
() => Buffer.alloc(1).equals('abc'),
|
|
{
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
name: 'TypeError',
|
|
message: 'The "otherBuffer" argument must be an instance of ' +
|
|
"Buffer or Uint8Array. Received type string ('abc')"
|
|
}
|
|
);
|