-
Notifications
You must be signed in to change notification settings - Fork 53
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
1db6a87
commit c733977
Showing
12 changed files
with
464 additions
and
17 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -38,6 +38,7 @@ Suggests: | |
asciicast, | ||
debugme, | ||
knitr, | ||
mockery, | ||
pillar, | ||
rmarkdown, | ||
testthat (>= 3.0.0), | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.onLoad <- function(libname, pkgname) { | ||
err$onload_hook() | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# cli_status | ||
|
||
Code | ||
pid <- cli_status("This is a status message") | ||
Message | ||
> This is a status message | ||
Code | ||
cli::cli_status_clear(pid, result = "clear") | ||
|
||
--- | ||
|
||
Code | ||
pid <- cli_status("This is a status message") | ||
Message | ||
> This is a status message | ||
Code | ||
cli::cli_status_clear(pid, result = "failed") | ||
Message | ||
x This is a status message | ||
|
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,163 @@ | ||
# pkg_error | ||
|
||
Code | ||
err | ||
Output | ||
<rlib_error_3_1/rlib_error/error> | ||
Error: | ||
! This is not good! | ||
i You should not use `foo`, use `bar` instead. | ||
|
||
# stop | ||
|
||
Code | ||
err | ||
Output | ||
<rlib_error_3_1/rlib_error/error> | ||
Error: | ||
! This is not good! | ||
i You should not use `foo`, use `bar` instead. | ||
|
||
# stop with message | ||
|
||
Code | ||
err | ||
Output | ||
<rlib_error_3_1/rlib_error/error> | ||
Error in `stop("Ooopsie daily!")`: | ||
! Ooopsie daily! | ||
|
||
# stopifnot | ||
|
||
Code | ||
stopifnot(1 == 2) | ||
Condition | ||
Error: | ||
! `1` must equal `2`. | ||
|
||
# zip | ||
|
||
Code | ||
zip(character(), character()) | ||
Output | ||
list() | ||
Code | ||
zip(letters[1:5], LETTERS[1:5]) | ||
Output | ||
[[1]] | ||
[1] "a" "A" | ||
[[2]] | ||
[1] "b" "B" | ||
[[3]] | ||
[1] "c" "C" | ||
[[4]] | ||
[1] "d" "D" | ||
[[5]] | ||
[1] "e" "E" | ||
Code | ||
zip("1", letters[1:5]) | ||
Output | ||
[[1]] | ||
[1] "1" "a" | ||
[[2]] | ||
[1] "1" "b" | ||
[[3]] | ||
[1] "1" "c" | ||
[[4]] | ||
[1] "1" "d" | ||
[[5]] | ||
[1] "1" "e" | ||
|
||
# unquote | ||
|
||
Code | ||
unquote("'quoted'") | ||
Output | ||
[1] "quoted" | ||
Code | ||
unquote(c("'quoted'", "not", "\"quoted\"")) | ||
Output | ||
[1] "quoted" "not" "quoted" | ||
|
||
# parse_url | ||
|
||
Code | ||
parse_url("https://github.com/r-hub/rhub") | ||
Output | ||
protocol host path | ||
1 https github.com /r-hub/rhub | ||
Code | ||
parse_url("https://[email protected]/r-hub/rhub") | ||
Output | ||
protocol host path | ||
1 https github.com /r-hub/rhub | ||
Code | ||
parse_url("https://user:[email protected]/r-hub/rhub") | ||
Output | ||
protocol host path | ||
1 https github.com /r-hub/rhub | ||
Code | ||
parse_url("https://github.com/r-hub/rhub?q=foo&p=bar") | ||
Output | ||
protocol host path | ||
1 https github.com /r-hub/rhub?q=foo&p=bar | ||
Code | ||
parse_url("[email protected]:/r-hub/rhub") | ||
Output | ||
protocol host path | ||
1 https github.com /r-hub/rhub | ||
Code | ||
parse_url("[email protected]:/r-hub/rhub.git") | ||
Output | ||
protocol host path | ||
1 https github.com /r-hub/rhub | ||
|
||
--- | ||
|
||
Code | ||
parse_url("this is not a URL at all") | ||
Condition | ||
Error in `parse_url()`: | ||
! Invalid URL: <this is not a URL at all> | ||
|
||
# ansi_align_width [plain] | ||
|
||
Code | ||
paste0("--", ansi_align_width(c("foo", "bar", "foobar")), "--") | ||
Output | ||
[1] "--foo --" "--bar --" "--foobar--" | ||
Code | ||
paste0("--", ansi_align_width(c("foo", "bar", cli::col_red("foobar"))), "--") | ||
Output | ||
[1] "--foo --" "--bar --" "--foobar--" | ||
Code | ||
ansi_align_width(character()) | ||
Output | ||
character(0) | ||
|
||
# ansi_align_width [ansi] | ||
|
||
Code | ||
paste0("--", ansi_align_width(c("foo", "bar", "foobar")), "--") | ||
Output | ||
[1] "--foo --" "--bar --" "--foobar--" | ||
Code | ||
paste0("--", ansi_align_width(c("foo", "bar", cli::col_red("foobar"))), "--") | ||
Output | ||
[1] "--foo --" "--bar --" | ||
[3] "--\033[31mfoobar\033[39m--" | ||
Code | ||
ansi_align_width(character()) | ||
Output | ||
character(0) | ||
|
Binary file not shown.
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,12 @@ | ||
Package: pkg | ||
Title: What the Package Does (One Line, Title Case) | ||
Version: 0.0.0.9000 | ||
Authors@R: | ||
person("First", "Last", , "[email protected]", role = c("aut", "cre"), | ||
comment = c(ORCID = "YOUR-ORCID-ID")) | ||
Description: What the package does (one paragraph). | ||
License: `use_mit_license()`, `use_gpl3_license()` or friends to pick a | ||
license | ||
Encoding: UTF-8 | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.3.1.9000 |
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,2 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
Binary file not shown.
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,11 @@ | ||
test_that("cli_status", { | ||
expect_snapshot({ | ||
pid <- cli_status("This is a status message") | ||
cli::cli_status_clear(pid, result = "clear") | ||
}) | ||
|
||
expect_snapshot({ | ||
pid <- cli_status("This is a status message") | ||
cli::cli_status_clear(pid, result = "failed") | ||
}) | ||
}) |
Oops, something went wrong.