-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
35d1027
commit c923764
Showing
4 changed files
with
59 additions
and
43 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# cli_abort() captures correct call and backtrace | ||
|
||
Code | ||
print(expect_error(f())) | ||
Output | ||
<error/rlang_error> | ||
Error in `h()`: | ||
! foo | ||
--- | ||
Backtrace: | ||
x | ||
1. +-base::print(expect_error(f())) | ||
2. +-testthat::expect_error(f()) | ||
3. | \-testthat:::expect_condition_matching(...) | ||
4. | \-testthat:::quasi_capture(...) | ||
5. | +-testthat (local) .capture(...) | ||
6. | | \-base::withCallingHandlers(...) | ||
7. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) | ||
8. \-cli (local) f() | ||
9. \-cli (local) g() | ||
10. \-cli (local) h() | ||
|
||
--- | ||
|
||
Code | ||
print(expect_error(f(list()))) | ||
Output | ||
<error/cli_my_class> | ||
Error in `h()`: | ||
! `x` can't be empty. | ||
--- | ||
Backtrace: | ||
x | ||
1. +-base::print(expect_error(f(list()))) | ||
2. +-testthat::expect_error(f(list())) | ||
3. | \-testthat:::expect_condition_matching(...) | ||
4. | \-testthat:::quasi_capture(...) | ||
5. | +-testthat (local) .capture(...) | ||
6. | | \-base::withCallingHandlers(...) | ||
7. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) | ||
8. \-cli (local) f(list()) | ||
9. \-cli (local) g(x) | ||
10. \-cli (local) h(x) | ||
|
||
# cli_abort(.internal = TRUE) reports the correct function (r-lib/rlang#1386) | ||
|
||
Code | ||
(expect_error(fn())) | ||
Output | ||
<error/rlang_error> | ||
Error in `fn()`: | ||
! Message. | ||
i This is an internal error that was detected in the base package. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters