-
Notifications
You must be signed in to change notification settings - Fork 29.1k
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: refactored context type err message to regex #12596
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,9 +62,27 @@ assert.ok(gh1140Exception, | |
'expected exception from runInContext signature test'); | ||
|
||
// GH-558, non-context argument segfaults / raises assertion | ||
[undefined, null, 0, 0.0, '', {}, []].forEach(function(e) { | ||
assert.throws(function() { script.runInContext(e); }, TypeError); | ||
assert.throws(function() { vm.runInContext('', e); }, TypeError); | ||
const nonContextualSandboxErrorMsg = | ||
/^TypeError: contextifiedSandbox argument must be an object\.$/; | ||
|
||
[undefined, null, 0, 0.0, ''].forEach(function(e) { | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary whitespace here and in the same place in the second section. |
||
assert.throws(function() { script.runInContext(e); }, | ||
nonContextualSandboxErrorMsg); | ||
assert.throws(function() { vm.runInContext('', e); }, | ||
nonContextualSandboxErrorMsg); | ||
}); | ||
|
||
// GH-558, non-context argument segfaults / raises assertion | ||
const contextifiedSandboxErrorMsg = | ||
/^TypeError: sandbox argument must have been converted to a context\.$/; | ||
|
||
[{}, []].forEach(function(e) { | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment here about the blank line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cjihrig that was my original thought, but i figured I'd skip the type checking and be more direct. I still have one more PR for this file and could change it then. What do you recommend? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of two separate loops, you could do the following with nested arrays:
Then, you pass the first element to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will do. Thanks! |
||
assert.throws(function() { script.runInContext(e); }, | ||
contextifiedSandboxErrorMsg); | ||
assert.throws(function() { vm.runInContext('', e); }, | ||
contextifiedSandboxErrorMsg); | ||
}); | ||
|
||
// Issue GH-693: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this blank line.