tests/testthat/test-github_token.R

test_that("code_hint_with_host() works", {

  expect_identical(code_hint_with_host("foo"), "foo()")
  expect_identical(code_hint_with_host("foo", arg_name = "arg"), "foo()")

  host_github <- "https://api.github.com"
  expect_identical(code_hint_with_host("foo", host = host_github), "foo()")
  expect_identical(
    code_hint_with_host("foo", host = host_github, arg_name = "arg"),
    "foo()"
  )

  host_ghe <- "https://github.acme.com"
  expect_identical(
    code_hint_with_host("foo", host = host_ghe),
    'foo("https://github.acme.com")'
  )
  expect_identical(
    code_hint_with_host("foo", host = host_ghe, arg_name = "arg"),
    'foo(arg = \"https://github.acme.com\")'
  )
})

Try the usethis package in your browser

Any scripts or data that you put into this service are public.

usethis documentation built on July 9, 2023, 7:23 p.m.