File: reporter-location.R

package info (click to toggle)
r-cran-testthat 3.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,452 kB
  • sloc: cpp: 9,261; ansic: 37; sh: 14; makefile: 5
file content (26 lines) | stat: -rw-r--r-- 758 bytes parent folder | download | duplicates (3)
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
#' Test reporter: location
#'
#' This reporter simply prints the location of every expectation and error.
#' This is useful if you're trying to figure out the source of a segfault,
#' or you want to figure out which code triggers a C/C++ breakpoint
#'
#' @export
#' @family reporters
LocationReporter <- R6::R6Class("LocationReporter",
  inherit = Reporter,
  public = list(
    start_test = function(context, test) {
      self$cat_line("Start test: ", test)
    },

    add_result = function(context, test, result) {
      status <- expectation_type(result)
      self$cat_line("  ", expectation_location(result), " [", status, "]")
    },

    end_test = function(context, test) {
      self$cat_line("End test: ", test)
      self$cat_line()
    }
  )
)