summaryrefslogtreecommitdiff
path: root/test/parallel/test-buffer-arraybuffer.js
AgeCommit message (Collapse)Author
2019-03-23errors: update error nameRuben Bridgewater
This updates all Node.js errors by removing the `code` being part of the `name` property. Instead, the name is just changed once on instantiation, the stack is accessed to create the stack as expected and then the `name` property is set back to it's original form. PR-URL: https://github.com/nodejs/node/pull/26738 Fixes: https://github.com/nodejs/node/issues/26669 Fixes: https://github.com/nodejs/node/issues/20253 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2018-10-17test: check codes of thrown errorsNancy Truong
PR-URL: https://github.com/nodejs/node/pull/23519 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: George Adams <george.adams@uk.ibm.com>
2018-04-13errors: validate input argumentsRuben Bridgewater
This makes sure the input arguments get validated so implementation errors will be caught early. It also improves a couple of error messages by providing more detailed information and fixes errors detected by the new functionality. Besides that a error type got simplified and tests got refactored. PR-URL: https://github.com/nodejs/node/pull/19924 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-04-01tools: add 'spaced-comment' into eslint rulesWeijia Wang
PR-URL: https://github.com/nodejs/node/pull/19596 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2018-03-02buffer: refactor all read/write functionsRuben Bridgewater
There are a lot of changes in this commit: 1) Remove the `noAssert` argument from all read and write functions. 2) Improve the performance of all read floating point functions significantly. This is done by switching to TypedArrays as the write floating point write functions. 3) No implicit type coercion for offset and byteLength anymore. 4) Adds a lot of tests. 5) Moves the read and write functions to the internal buffer file to split the files in smaller chunks. 6) Reworked a lot of existing tests. 7) Improve the performane of all all read write functions by using a faster input validation and by improving function logic. 8) Significantly improved the performance of all read int functions. This is done by using a implementation without a loop. 9) Improved error handling. 10) Rename test file to use the correct subsystem. PR-URL: https://github.com/nodejs/node/pull/18395 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2018-02-16buffer: remove obsolete NaN checkRuben Bridgewater
These two NaN entries are not necessary and we can safely remove them. PR-URL: https://github.com/nodejs/node/pull/18744 Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-12-08test: replace assert.throws w/ common.expectsErrorMithun Sasidharan
PR-URL: https://github.com/nodejs/node/pull/17483 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-07-12errors,buffer: port errors to internal/errorsstarkwang
PR-URL: https://github.com/nodejs/node/pull/13976 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2017-06-24test: remove require('buffer') from 4 buffer testsOriLev
Remove superfluous import from: * test/parallel/test-buffer-alloc.js * test/parallel/test-buffer-arraybuffer.js * test/parallel/test-buffer-badhex.js * test/parallel/test-buffer-bytelength.js Refs: https://github.com/nodejs/node/issues/13836 PR-URL: https://github.com/nodejs/node/pull/13855 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-19test: increase coverage for buffer.jsRich Trott
Add coverage for non-numeric byteOffset and length when using Buffer.from() with an ArrayBuffer. PR-URL: https://github.com/nodejs/node/pull/12476 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2016-12-12test: refactor assert.equal, update syntax to ES6Prieto, Marcos
PR-URL: https://github.com/nodejs/node/pull/10190 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2016-09-08buffer: expose underlying buffer object alwaysSakthipriyan Vairamani
If the Buffer object's length is zero, or equal to the underlying buffer object's length, `parent` property returns `undefined`. > new Buffer(0).parent undefined > new Buffer(Buffer.poolSize).parent undefined This patch makes the buffer objects to consistently expose the buffer object via the `parent` property, always. Fixes: https://github.com/nodejs/node/issues/8266 PR-URL: https://github.com/nodejs/node/pull/8311 Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-29test: additional refactoring/cleanup of buffer testsJames M Snell
* 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-03-16buffer: add .from(), .alloc() and .allocUnsafe()James M Snell
Several changes: * Soft-Deprecate Buffer() constructors * Add `Buffer.from()`, `Buffer.alloc()`, and `Buffer.allocUnsafe()` * Add `--zero-fill-buffers` command line option * Add byteOffset and length to `new Buffer(arrayBuffer)` constructor * buffer.fill('') previously had no effect, now zero-fills * Update the docs PR-URL: https://github.com/nodejs/node/pull/4682 Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2016-02-10tools: enable no-proto rule for linterJackson Tian
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>
2015-12-26test: remove unnecessary assignmentsRich Trott
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-11-16buffer: let WriteFloatGeneric silently drop valuesP.S.V.R
Documentation currently states that setting noAssert and passing a value larger than can fit in the Buffer will cause data to be silently dropped. Change implementation to match documented behavior. Fixes: https://github.com/nodejs/node/issues/3766 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-08-04buffer: allow ArrayBuffer as Buffer argumentTrevor Norris
Buffer now uses the ArrayBuffer as the backing store if passed to the constructor. Fixes: https://github.com/nodejs/io.js/issues/106 PR-URL: https://github.com/nodejs/io.js/pull/2002 Reviewed-By: Domenic Denicola <d@domenic.me>