Skip to content

Commit

Permalink
test: add tests for process.setgroups()
Browse files Browse the repository at this point in the history
Added tests to validate process.setgroups() arguments

PR-URL: #21286
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
Masashi Hirano authored and targos committed Jun 22, 2018
1 parent e944749 commit d7ff752
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/parallel/test-process-setgroups.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
'use strict';
require('../common');
const assert = require('assert');

assert.throws(
() => {
process.setgroups();
},
{
name: 'TypeError',
message: 'argument 1 must be an array'
}
);

assert.throws(
() => {
process.setgroups([1, -1]);
},
{
name: 'Error',
message: 'group name not found'
}
);

[undefined, null, true, {}, [], () => {}].forEach((val) => {
assert.throws(
() => {
process.setgroups([val]);
},
{
name: 'Error',
message: 'group name not found'
}
);
});

0 comments on commit d7ff752

Please sign in to comment.