File: test-s4-export.r

package info (click to toggle)
r-cran-pkgload 1.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 788 kB
  • sloc: ansic: 30; sh: 13; cpp: 9; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 735 bytes parent folder | download | duplicates (2)
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
context("s4-export")


test_that("importing an S4 exported by another pkg with export_all = FALSE", {
  load_all("testS4export", export_all = FALSE)

  # this used to crash with error: 
  # class "class_to_export" is not exported by 'namespace:testS4export'
  load_all("testS4import", export_all = FALSE)
  expect_true(isClassDef(getClass("derived")))

  load_all("testS4import", export_all = FALSE)

  cl <- getClass("derived")
  expect_true(isClassDef(cl))

  expect_is(cl@contains$class_to_export, "SClassExtension")
  expect_equal(cl@contains$class_to_export@distance, 1)

  expect_is(cl@contains$foo, "SClassExtension")
  expect_equal(cl@contains$foo@distance, 2)

  # cleanup
  unload('testS4import')
  unload('testS4export')
})