Skip to content

Commit

Permalink
Merge pull request #24 from chainsawriot/fix_has_creds
Browse files Browse the repository at this point in the history
Fix `ada_has_credentials` vectorization
  • Loading branch information
schochastics authored Sep 24, 2023
2 parents 625ef06 + f955b2d commit 8d7b042
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/has.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' @export
ada_has_credentials <- function(url) {
url <- utf8::as_utf8(url)
vapply(url, function(x) vapply(url, function(x) Rcpp_ada_has_credentials(x, nchar(x, type = "bytes")), logical(1)), logical(1))
vapply(url, function(x) Rcpp_ada_has_credentials(x, nchar(x, type = "bytes")), logical(1))
}

#' Check if URL has an empty hostname
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-has.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ test_that("all has functions work", {
expect_true(ada_has_port(url))
expect_true(ada_has_search(url))
})

test_that("ada_has_credentials is vectorized ref #3", {
expect_error(res <- ada_has_credentials(c("https://admin:[email protected]/basic_auth", "https://www.google.com")), NA)
})

0 comments on commit 8d7b042

Please sign in to comment.