File: test-conditions.R

package info (click to toggle)
r-cran-assertive.base 0.0-9-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, trixie
  • size: 476 kB
  • sloc: sh: 13; makefile: 2
file content (41 lines) | stat: -rw-r--r-- 1,196 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
29
30
31
32
33
34
35
36
37
38
39
40
41
test_that(
  "assertionError returns a simpleError with extra classes", {
    expected <- structure(
      list(message = "Uh-oh!", call = NULL, predicate_name = NULL),
      class = c(
        "assertionError", "assertionCondition", 
        "simpleError", "error", "condition"
      )
    )
    actual <- assertionError("Uh-oh!")
    expect_identical(actual, expected)
  }
)

test_that(
  "assertionWarning returns a simpleWarning with extra classes", {
    expected <- structure(
      list(message = "Uh-oh!", call = NULL, predicate_name = NULL),
      class = c(
        "assertionWarning", "assertionCondition", 
        "simpleWarning", "warning", "condition"
      )
    )
    actual <- assertionWarning("Uh-oh!")
    expect_identical(actual, expected)
  }
)

test_that(
  "assertionMessage returns a simpleMessage with extra classes", {
    expected <- structure(
      list(message = "Uh-oh!", call = NULL, predicate_name = NULL),
      class = c(
        "assertionMessage", "assertionCondition", 
        "simpleMessage", "message", "condition"
      )
    )
    actual <- assertionMessage("Uh-oh!")
    expect_identical(actual, expected)
  }
)