File: test-topic.R

package info (click to toggle)
r-cran-roxygen2 7.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,940 kB
  • sloc: cpp: 351; sh: 14; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 574 bytes parent folder | download | duplicates (4)
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("adding tags merges with existing", {
  rd <- RoxyTopic$new()

  rd$add(rd_section("x", 1))
  rd$add(rd_section("x", 2))

  expect_equal(rd$get_value("x"), c(1, 2))
})

test_that("unless overwrite = TRUE", {
  rd <- RoxyTopic$new()

  rd$add(rd_section("x", 1))
  rd$add(rd_section("x", 2), overwrite = TRUE)

  expect_equal(rd$get_value("x"), 2)
})

test_that("can add a complete file", {
  rd1 <- RoxyTopic$new()
  rd2 <- RoxyTopic$new()

  rd1$add(rd_section("x", 1))
  rd2$add(rd_section("x", 2))
  rd2$add(rd1)

  expect_equal(rd2$get_value("x"), c(2, 1))
})