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

assert: support symbols as assertion messages #20693

Merged
merged 1 commit into from
May 15, 2018
Merged

Conversation

cjihrig
Copy link
Contributor

@cjihrig cjihrig commented May 13, 2018

Currently, assertion messages are implicitly converted to strings, which causes symbols to throw. This commit adds an explicit string conversion.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the assert Issues and PRs related to the assert subsystem. label May 13, 2018
@lpinca
Copy link
Member

lpinca commented May 13, 2018

CI: https://ci.nodejs.org/job/node-test-pull-request/14834/

EDIT (cjihrig): For future reference, CI was green.

@lpinca lpinca added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 13, 2018
@BridgeAR
Copy link
Member

@cjihrig did you run into this and have a actual use case for it? Just curious because I try to find some ways to improve the messages in general a bit more.

@cjihrig
Copy link
Contributor Author

cjihrig commented May 13, 2018

did you run into this and have a actual use case for it?

I did run into it accidentally. I don't personally have a use case for it, but it seems like a bug for symbols to throw here.

Currently, assertion messages are implicitly converted to strings,
which causes symbols to throw. This commit adds an explicit
string conversion.

PR-URL: nodejs#20693
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@cjihrig cjihrig merged commit 810af50 into nodejs:master May 15, 2018
@cjihrig cjihrig deleted the assert branch May 15, 2018 03:45
MylesBorins pushed a commit that referenced this pull request May 22, 2018
Currently, assertion messages are implicitly converted to strings,
which causes symbols to throw. This commit adds an explicit
string conversion.

PR-URL: #20693
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@addaleax addaleax mentioned this pull request May 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assert Issues and PRs related to the assert subsystem. author ready PRs that have at least one approval, no pending requests for changes, and a CI started.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants