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

getParseData() always returns NULL in IDEs tests #2008

Closed
DanChaltiel opened this issue Nov 3, 2024 · 2 comments
Closed

getParseData() always returns NULL in IDEs tests #2008

DanChaltiel opened this issue Nov 3, 2024 · 2 comments

Comments

@DanChaltiel
Copy link

Hi,

My package tests are failing because of this very peculiar bug and I have unfortunately no idea how to debug it.

The following test fails in the RStudio build pane and in Positron test suite, but succeeds in any R console.
Running testthat::test_file() in the console succeeds, but clicking the buttons "Run tests" in the file or "Test" in the Build pane fails.

test_that("multiplication works", {
  # a = getParseData(parse(text="# foobar")) #same result
  a = getParseData(parse(text="a=1"))
  expect_false(is.null(a))
})
@hadley
Copy link
Member

hadley commented Nov 4, 2024

Set keep.source = TRUE in parse()?

@DanChaltiel
Copy link
Author

Yes, that works! I would never guess that was the fix.
Thanks a lot, Hadley 🙏
That fixed my problem, you can close the issue if nothing should change on your end.

@hadley hadley closed this as completed Nov 5, 2024
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

No branches or pull requests

2 participants