test: use error code mapping in place of raw errno

Refs: https://github.com/nodejs/node/pull/38159#discussion_r610288214

PR-URL: https://github.com/nodejs/node/pull/38675
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
Darshan Sen authored and James M Snell committed 2021-08-28 08:42:44 -07:00
1 parent 7b7a0331f4
commit 21cf618c22
1 file changed
+2 -2
+2 -2
View File
@@ -117,7 +117,7 @@ fs.read(fd,
common.mustCall((err) => {
if (err) {
if (common.isIBMi)
assert.strictEqual(err.errno, -127);
assert.strictEqual(err.code, 'EOVERFLOW');
else
assert.strictEqual(err.code, 'EFBIG');
}
@@ -238,6 +238,6 @@ try {
// On systems where max file size is below 2^53-1, we'd expect a EFBIG error.
// This is not using `assert.throws` because the above call should not raise
// any error on systems that allows file of that size.
if (err.code !== 'EFBIG' && !(common.isIBMi && err.errno === -127))
if (err.code !== 'EFBIG' && !(common.isIBMi && err.code === 'EOVERFLOW'))
throw err;
}