This file is indexed.

/usr/share/doc/r-cran-crul/tests/testthat/test-query.R is in r-cran-crul 0.5.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
context("query")

test_that("query works", {
  skip_on_cran()

  cli <- HttpClient$new(url = "https://httpbin.org")
  aa <- cli$get('get', query = list(hello = "world"))

  expect_is(aa, "HttpResponse")
  expect_match(aa$url, "hello")
  expect_match(aa$url, "world")
  expect_match(jsonlite::fromJSON(aa$parse())$url, "hello")
  expect_match(jsonlite::fromJSON(aa$parse())$url, "world")
})

test_that("query - multiple params of same name work", {
  skip_on_cran()

  cli <- HttpClient$new(url = "https://httpbin.org")
  aa <- cli$get('get', query = list(hello = 5, hello = 6))

  expect_is(aa, "HttpResponse")
  expect_equal(length(gregexpr("hello", aa$url)[[1]]), 2)
  expect_equal(
    length(gregexpr("hello", jsonlite::fromJSON(aa$parse())$url)[[1]]), 2)
})

test_that("query - length 0 query list works", {
  skip_on_cran()

  cli <- HttpClient$new(url = "https://httpbin.org")
  aa <- cli$get('get', query = list())

  expect_is(aa, "HttpResponse")
  expect_false(grepl("\\?", aa$url))
})