1context("s4-export")
2
3
4test_that("importing an S4 exported by another pkg with export_all = FALSE", {
5  load_all("testS4export", export_all = FALSE)
6
7  # this used to crash with error:
8  # class "class_to_export" is not exported by 'namespace:testS4export'
9  load_all("testS4import", export_all = FALSE)
10  expect_true(isClassDef(getClass("derived")))
11
12  load_all("testS4import", export_all = FALSE)
13
14  cl <- getClass("derived")
15  expect_true(isClassDef(cl))
16
17  expect_is(cl@contains$class_to_export, "SClassExtension")
18  expect_equal(cl@contains$class_to_export@distance, 1)
19
20  expect_is(cl@contains$foo, "SClassExtension")
21  expect_equal(cl@contains$foo@distance, 2)
22
23  # cleanup
24  unload('testS4import')
25  unload('testS4export')
26})
27