Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

MichaelChirico
Copy link
Contributor

This makes tests less hermetic by creating permanent side effects that survive the test file.

Also remove deprecated expect_is() in anticipation of upgrading to {testthat} 3rd edition.

@flying-sheep flying-sheep added this pull request to the merge queue Nov 13, 2023
@flying-sheep
Copy link
Member

Thanks!

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 13, 2023
tests/testthat/test_utils.r Outdated Show resolved Hide resolved
expect_is(skipped_stack[[1]], 'call')
# See discussion in #741 about using inherits() here and not
# expect_type(., "language") or expect_true(is.call(.)) or expect_mode(., "call")
expect_true(inherits(skipped_stack[[1]], 'call'))
Copy link

Choose a reason for hiding this comment

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

I think you could make this test more clear by making it more explicit:

expect_equal(skipped_stack[[1]], quote(f(1)))

Or even:

expect_equal(skipped_stack, list(quote(f(1)), quote(stop(x))))

That illustrates a subtle problem somewhere in the stack because if you print skipped_stack you see:

[[1]]
f(1)

[[2]]
function(x) stop(x)

Because the srcref is out of sync with the actual contents of the element.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.