Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8b02b4e

Browse filesBrowse files
liirene1Italo A. Casas
authored andcommitted
test: check error msg test-writeint.js
PR-URL: #10755 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 4de7b03 commit 8b02b4e
Copy full SHA for 8b02b4e

File tree

Expand file treeCollapse file tree

1 file changed

+13
-12
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-12
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-writeint.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-writeint.js
+13-12Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55
require('../common');
66
const assert = require('assert');
7+
const errorOutOfBounds = /^TypeError: "value" argument is out of bounds$/;
78

89
function test8(clazz) {
910
var buffer = new clazz(2);
@@ -17,10 +18,10 @@ function test8(clazz) {
1718
/* Make sure we handle truncation correctly */
1819
assert.throws(function() {
1920
buffer.writeInt8(0xabc, 0);
20-
});
21+
}, errorOutOfBounds);
2122
assert.throws(function() {
2223
buffer.writeInt8(0xabc, 0);
23-
});
24+
}, errorOutOfBounds);
2425

2526
/* Make sure we handle min/max correctly */
2627
buffer.writeInt8(0x7f, 0);
@@ -30,10 +31,10 @@ function test8(clazz) {
3031
assert.equal(0x80, buffer[1]);
3132
assert.throws(function() {
3233
buffer.writeInt8(0x7f + 1, 0);
33-
});
34+
}, errorOutOfBounds);
3435
assert.throws(function() {
3536
buffer.writeInt8(-0x80 - 1, 0);
36-
});
37+
}, errorOutOfBounds);
3738
}
3839

3940

@@ -70,10 +71,10 @@ function test16(clazz) {
7071
assert.equal(0x00, buffer[3]);
7172
assert.throws(function() {
7273
buffer.writeInt16BE(0x7fff + 1, 0);
73-
});
74+
}, errorOutOfBounds);
7475
assert.throws(function() {
7576
buffer.writeInt16BE(-0x8000 - 1, 0);
76-
});
77+
}, errorOutOfBounds);
7778

7879
buffer.writeInt16LE(0x7fff, 0);
7980
buffer.writeInt16LE(-0x8000, 2);
@@ -83,10 +84,10 @@ function test16(clazz) {
8384
assert.equal(0x80, buffer[3]);
8485
assert.throws(function() {
8586
buffer.writeInt16LE(0x7fff + 1, 0);
86-
});
87+
}, errorOutOfBounds);
8788
assert.throws(function() {
8889
buffer.writeInt16LE(-0x8000 - 1, 0);
89-
});
90+
}, errorOutOfBounds);
9091
}
9192

9293

@@ -139,10 +140,10 @@ function test32(clazz) {
139140
assert.equal(0x00, buffer[7]);
140141
assert.throws(function() {
141142
buffer.writeInt32BE(0x7fffffff + 1, 0);
142-
});
143+
}, errorOutOfBounds);
143144
assert.throws(function() {
144145
buffer.writeInt32BE(-0x80000000 - 1, 0);
145-
});
146+
}, errorOutOfBounds);
146147

147148
buffer.writeInt32LE(0x7fffffff, 0);
148149
buffer.writeInt32LE(-0x80000000, 4);
@@ -156,10 +157,10 @@ function test32(clazz) {
156157
assert.equal(0x80, buffer[7]);
157158
assert.throws(function() {
158159
buffer.writeInt32LE(0x7fffffff + 1, 0);
159-
});
160+
}, errorOutOfBounds);
160161
assert.throws(function() {
161162
buffer.writeInt32LE(-0x80000000 - 1, 0);
162-
});
163+
}, errorOutOfBounds);
163164
}
164165

165166

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.