Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: merge test with unnecessary child process #25025

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions test/parallel/test-crypto-hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,17 @@ assert.throws(function() {
crypto.createHash('xyzzy');
}, /Digest method not supported/);

// Issue https://github.com/nodejs/node/issues/9819: throwing encoding used to
// segfault.
common.expectsError(
() => crypto.createHash('sha256').digest({
toString: () => { throw new Error('boom'); },
}),
{
type: Error,
message: 'boom'
});

// Default UTF-8 encoding
const hutf8 = crypto.createHash('sha512').update('УТФ-8 text').digest('hex');
assert.strictEqual(
Expand Down
10 changes: 10 additions & 0 deletions test/parallel/test-crypto-hmac.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ common.expectsError(
message: 'The "hmac" argument must be of type string. Received type object'
});

// This used to segfault. See: https://github.com/nodejs/node/issues/9819
common.expectsError(
() => crypto.createHmac('sha256', 'key').digest({
toString: () => { throw new Error('boom'); },
}),
{
type: Error,
message: 'boom'
});

common.expectsError(
() => crypto.createHmac('sha1', null),
{
Expand Down
27 changes: 0 additions & 27 deletions test/parallel/test-crypto-tostring-segfault.js

This file was deleted.