-
-
Notifications
You must be signed in to change notification settings - Fork 206
Address review feedback: use helper for error snapshots and add test function #2522
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
Changes from all commits
afab014
d905292
331d876
f628871
98a83e4
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 |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # error messages include source file and line information | ||
|
|
||
| Code | ||
| test_error_with_source() | ||
| Condition | ||
| Error in `test_error_with_source()`: | ||
| ! Test error message for verifying source location formatting. Invalid value | ||
| Source: rinterface_extra.c:<linenumber> | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,8 @@ | ||||||||
| test_that("error messages include source file and line information", { | ||||||||
| expect_snapshot( | ||||||||
| error = TRUE, | ||||||||
|
||||||||
| error = TRUE, | |
| error = TRUE, | |
| transform = function(x) sub(":(\\d+)", ":<linenumber>", x), |
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.
The snapshot uses
<linenumber>as a placeholder, but the codebase convention is to use:xx. The helper functionexpect_snapshot_igraph_error()(tests/testthat/helper.R:47-56) usesgsub(":(\\d+)", ":xx", y), and this pattern is used in the vast majority of error snapshots (e.g., tests/testthat/_snaps/aaa-auto.md and tests/testthat/_snaps/centrality.md).Only a couple of tests in
test-games.Ruse<linenumber>, which appears to be an exception to the established convention. For consistency, consider using theexpect_snapshot_igraph_error()helper and updating the snapshot to use:xxinstead of<linenumber>.