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: improve tests for util.inherits #3507

Closed
wants to merge 2 commits into from

Conversation

targos
Copy link
Member

@targos targos commented Oct 24, 2015

inherits is used in lib and tests but its functionality itself is not
tested yet.

This is preparation for PR #3455 so I can add more tests to it.

inherits is used in lib and tests but its functionality itself is not
tested yet.
@targos targos added the test Issues and PRs related to the tests. label Oct 24, 2015
@targos
Copy link
Member Author

targos commented Oct 24, 2015

@thefourtheye
Copy link
Contributor

inherits actually sets a property called super_. Can you throw in some asserts to check that as well?

@targos
Copy link
Member Author

targos commented Oct 24, 2015

Good point, done!

assert.throws(function() { util.inherits(ctor, {}); }, TypeError);
assert.throws(function() { util.inherits(ctor, null); }, TypeError);
assert.throws(function() { util.inherits(null, ctor); }, TypeError);
assert.doesNotThrow(function() { util.inherits(ctor, ctor); }, TypeError);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is removed in favour of #3455?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really. I think this line was added to make sure inherits doesn't throw when two constructors are passed to it. Now it is implicitly tested with this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, okay. Thanks :)

@thefourtheye
Copy link
Contributor

LGTM

@mscdex mscdex added the util Issues and PRs related to the built-in util module. label Oct 24, 2015
targos added a commit that referenced this pull request Oct 26, 2015
inherits is used in lib and tests but its functionality itself is not
tested yet.

PR-URL: #3507
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
@targos
Copy link
Member Author

targos commented Oct 26, 2015

Thanks, landed in df738ac.

@targos targos closed this Oct 26, 2015
@targos targos deleted the better-test-inherits branch October 26, 2015 08:39
targos added a commit that referenced this pull request Oct 26, 2015
inherits is used in lib and tests but its functionality itself is not
tested yet.

PR-URL: #3507
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
@rvagg rvagg mentioned this pull request Oct 27, 2015
@targos
Copy link
Member Author

targos commented Oct 27, 2015

@jasnell I think this can go in v4.x

targos added a commit that referenced this pull request Oct 28, 2015
inherits is used in lib and tests but its functionality itself is not
tested yet.

PR-URL: #3507
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
@jasnell
Copy link
Member

jasnell commented Oct 28, 2015

Landed in v4.x-staging in 12d8385

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests. util Issues and PRs related to the built-in util module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants