File: test-dollarnames.R

package info (click to toggle)
r-cran-r6 2.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 376 kB
  • sloc: sh: 10; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 786 bytes parent folder | download
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
test_that(".DollarNames works as expected", {
  AC <- R6Class("AC",
    public = list(
      x = 1,
      .y = 1
    ),
    private = list(
      px = 1,
      .py = 1
    ),
    active = list(
      ax = function(value) 1,
      .ay = function(value) 1
    )
  )

  a <- AC$new()
  expected_names <- c("x", ".y", "ax", ".ay", "clone")
  expect_setequal(.DollarNames(a, ""), expected_names)
  expect_setequal(utils:::.DollarNames(a, ""), expected_names)

  # Tests for direct calling of .DollarNames.R6 without S3 dispatch
  # https://github.com/rstudio/rstudio/issue/15706
  # https://github.com/rstudio/rstudio/pull/15707
  expect_setequal(R6:::.DollarNames.R6(a, ""), expected_names)
  DollarNamesR6 <- R6:::.DollarNames.R6
  expect_setequal(DollarNamesR6(a, ""), expected_names)
})