Skip to content

Commit d7ff752

Browse files
Masashi Hiranotargos
Masashi Hirano
authored andcommitted
test: add tests for process.setgroups()
Added tests to validate process.setgroups() arguments PR-URL: #21286 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent e944749 commit d7ff752

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
'use strict';
2+
require('../common');
3+
const assert = require('assert');
4+
5+
assert.throws(
6+
() => {
7+
process.setgroups();
8+
},
9+
{
10+
name: 'TypeError',
11+
message: 'argument 1 must be an array'
12+
}
13+
);
14+
15+
assert.throws(
16+
() => {
17+
process.setgroups([1, -1]);
18+
},
19+
{
20+
name: 'Error',
21+
message: 'group name not found'
22+
}
23+
);
24+
25+
[undefined, null, true, {}, [], () => {}].forEach((val) => {
26+
assert.throws(
27+
() => {
28+
process.setgroups([val]);
29+
},
30+
{
31+
name: 'Error',
32+
message: 'group name not found'
33+
}
34+
);
35+
});

0 commit comments

Comments
 (0)