Commit Graph

6 Commits

Author SHA1 Message Date
David Sánchez
945134361f test: refactoring test, reordering arguments
Refactors the test-buffer-inheritance.js test, switches the order of the
arguments to be: 'actual', 'expected'

PR-URL: https://github.com/nodejs/node/pull/28343
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-06-26 16:29:10 +08:00
Rich Trott
4316f4df31 test,lib: align arguments in multiline calls
An upcoming custom lint rule will provide slightly more strict
enforcement of argument alignment for multiline function calls. Adjust
existing code to conform.

PR-URL: https://github.com/nodejs/node/pull/8642
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2016-09-20 10:22:23 -07:00
James M Snell
4537cf2377 test: additional refactoring/cleanup of buffer tests
* Favor use of strictEqual where possible
* Use const as appropriate
* Other miscellaneous cleanups

PR-URL: https://github.com/nodejs/node/pull/8283
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
2016-08-29 15:24:03 -07:00
Jackson Tian
cc195bf37b tools: enable no-proto rule for linter
Enable `no-proto` in `.eslintrc`.

Use `Object.setPrototypeOf()` and `Object.getPrototypeOf()`
instead of.

PR-URL: https://github.com/nodejs/node/pull/5140
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-02-10 08:40:23 -08:00
Rich Trott
082cc8d6d8 test: remove unnecessary assignments
common.js needs to be loaded in all tests so that there is checking
for variable leaks and possibly other things. However, it does not
need to be assigned to a variable if nothing in common.js is referred
to elsewhere in the test.

PR-URL: https://github.com/nodejs/node/pull/4408
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-12-26 18:00:02 -08:00
Trevor Norris
05d424c029 buffer: only check if instance is Uint8Array
Native Buffer method calls do not require anything from the prototype.
So it is unnecessary to check if the Object's prototype is equal to
Buffer.prototype.

This fixes an issue that prevents Buffer from being inherited the ES5
way. Now the following will work:

    function A(n) {
      const b = new Buffer(n);
      Object.setPrototypeOf(b, A.prototype);
      return b;
    }

    Object.setPrototypeOf(A.prototype, Buffer.prototype);
    Object.setPrototypeOf(A, Buffer);

    console.log(new A(4));

Fix: https://github.com/nodejs/node/issues/2882
PR-URL: https://github.com/nodejs/node/pull/3080
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-10-06 15:41:24 -06:00