Skip to content

Commit

Permalink
Better use of stbl. (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonthegeek authored Oct 25, 2023
1 parent e7d1658 commit 1ef21ea
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ importFrom(rlang,"%||%")
importFrom(rlang,caller_arg)
importFrom(rlang,caller_env)
importFrom(rlang,check_dots_empty)
importFrom(stbl,stabilize_chr)
importFrom(stbl,stabilize_chr_scalar)
importFrom(stbl,to_chr_scalar)
importFrom(xml2,url_absolute)
importFrom(yaml,read_yaml)
2 changes: 1 addition & 1 deletion R/components-security_scheme-oauth2-scopes.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ S7::method(
) <- function(x, ..., arg = caller_arg(x), call = caller_env()) {
force(arg)
x <- unlist(x)
x <- stbl::stabilize_chr(x, x_arg = arg)
x <- stabilize_chr(x, x_arg = arg)
if (!rlang::is_named2(x)) {
cli::cli_abort(
"{.arg {arg}} must be a named character vector.",
Expand Down
6 changes: 3 additions & 3 deletions R/properties.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ character_scalar_property <- function(x_arg, ...) {
setter = function(self, value) {
call <- caller_env(3)
value <- value %||% character()
value <- stbl::stabilize_chr_scalar(
value <- stabilize_chr_scalar(
value,
allow_null = FALSE,
x_arg = x_arg,
Expand All @@ -40,7 +40,7 @@ enum_property <- function(x_arg) {
value <- purrr::map(
value,
function(enumerations) {
enumerations <- stbl::stabilize_chr(
enumerations <- stabilize_chr(
enumerations,
allow_na = FALSE,
x_arg = x_arg,
Expand Down Expand Up @@ -69,7 +69,7 @@ list_of_characters <- function(x_arg, ...) {
value,
function(x) {
x <- x %|0|% character()
stbl::stabilize_chr(
stabilize_chr(
x,
allow_na = FALSE,
x_arg = x_arg,
Expand Down
2 changes: 1 addition & 1 deletion R/rapid-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#' @importFrom S7 class_missing
#' @importFrom S7 prop
#' @importFrom S7 prop<-
#' @importFrom stbl stabilize_chr
#' @importFrom stbl stabilize_chr_scalar
#' @importFrom stbl to_chr_scalar
#' @importFrom xml2 url_absolute
#' @importFrom yaml read_yaml
## usethis namespace: end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ test_that("as_scopes() errors informatively for bad classes", {
)
})

test_that("as_scopes() errors informatively for weird lists", {
expect_error(
as_scopes(list(a = mean)),
class = "stbl_error_coerce_character"
)
})

test_that("as_scopes() returns expected objects", {
expect_identical(
as_scopes(
Expand Down

0 comments on commit 1ef21ea

Please sign in to comment.