Running ‘exporting-methods.R’ [2s/4s]
  Running ‘testthat.R’ [12s/17s]
Running the tests in ‘tests/exporting-methods.R’ failed.
Complete output:
  > # the testthat library executes test within the optmatch namespace, 
  > # so it can't detect if we forget to export methods
  > # R CMD check tests, on the other hand, use the package externally
  > 
  > library(optmatch)
  Loading required package: survival
  The optmatch package has an academic license. Enter relaxinfo() for more information.
  > 
  > data(nuclearplants)
  > 
  > ### as.matrix
  > 
  > # sparse
  > tmp <- match_on(pr ~ date + cost, data = nuclearplants, within = exactMatch(pr ~ pt, data = nuclearplants))
  > 
  > tmp.m <- as.matrix(tmp)
  > 
  > stopifnot(dim(tmp.m) == c(10,22))
  > stopifnot(class(tmp.m) == "matrix")
  Error: class(tmp.m) == "matrix" are not all TRUE
  Execution halted
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(optmatch)
  Loading required package: survival
  The optmatch package has an academic license. Enter relaxinfo() for more information.
  > 
  > test_check("optmatch")
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  optmatch
   --- call from context --- 
  optmatch_same_distance(f1, as.matrix(res.b))
   --- call from argument --- 
  if (!class(newdist) %in% c("BlockedInfinitySparseMatrix", "InfinitySparseMatrix", 
      "DenseMatrix")) {
      stop("newdist must be a valid distance")
  }
   --- R stacktrace ---
  where 1: optmatch_same_distance(f1, as.matrix(res.b))
  where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
  where 3: withCallingHandlers({
      code
      NULL
  }, error = function(cnd) {
      cnd <- cnd_entrace(cnd)
      return_from(env, cnd)
  })
  where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)), 
      ...)
  where 5: quasi_capture(enquo(object), label, capture_error, entrace = TRUE)
  where 6 at testthat/test.Optmatch.R#311: expect_error(optmatch_same_distance(f1, as.matrix(res.b)), "newdist must be a valid distance")
  where 7: eval(code, test_env)
  where 8: eval(code, test_env)
  where 9: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 10: doTryCatch(return(expr), name, parentenv, handler)
  where 11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 12: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 13: doTryCatch(return(expr), name, parentenv, handler)
  where 14: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 15: tryCatchList(expr, classes, parentenv, handlers)
  where 16: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 17: test_code(desc, code, env = parent.frame())
  where 18 at testthat/test.Optmatch.R#287: test_that("optmatch_same_distance", {
      d <- data.frame(Z = c(1, 0, 0, 0, 0, 1, 0, 0), B = rep(c("a", 
          "b"), times = c(5, 3)))
      res.b <- exactMatch(Z ~ B, data = d)
      res.b2 <- res.b
      res.b2@.Data[1] <- 1
      f1 <- fullmatch(res.b, data = d)
      f2 <- fullmatch(res.b2, data = d)
      options(optmatch_verbose_messaging = TRUE)
      expect_warning(f3 <- fullmatch(res.b, data = d, max.controls = 1), 
          "infeasible")
      expect_true(optmatch_same_distance(f1, res.b))
      expect_true(optmatch_same_distance(f2, res.b2))
      expect_true(optmatch_same_distance(f3, res.b))
      expect_true(!optmatch_same_distance(f1, res.b2))
      expect_true(!optmatch_same_distance(f2, res.b))
      expect_true(!optmatch_same_distance(f3, res.b2))
      expect_error(optmatch_same_distance(res.b, res.b), "obj must be an optmatch object")
      expect_error(optmatch_same_distance(f1, as.matrix(res.b)), 
          "newdist must be a valid distance")
  })
  where 19: eval(code, test_env)
  where 20: eval(code, test_env)
  where 21: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 22: doTryCatch(return(expr), name, parentenv, handler)
  where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 24: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 25: doTryCatch(return(expr), name, parentenv, handler)
  where 26: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 27: tryCatchList(expr, classes, parentenv, handlers)
  where 28: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 29: test_code(NULL, exprs, env)
  where 30: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 31: force(code)
  where 32: doWithOneRestart(return(expr), restart)
  where 33: withOneRestart(expr, restarts[[1L]])
  where 34: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 35: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 36: FUN(X[[i]], ...)
  where 37: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 38: force(code)
  where 39: doWithOneRestart(return(expr), restart)
  where 40: withOneRestart(expr, restarts[[1L]])
  where 41: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 42: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 43: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 45: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 46: test_check("optmatch")
  
   --- value of length: 2 type: logical ---
  [1] TRUE TRUE
   --- function from context --- 
  function (obj, newdist) 
  {
      if (!is(obj, "optmatch")) {
          stop("obj must be an optmatch object")
      }
      if (!class(newdist) %in% c("BlockedInfinitySparseMatrix", 
          "InfinitySparseMatrix", "DenseMatrix")) {
          stop("newdist must be a valid distance")
      }
      return(attr(obj, "hashed.distance") == dist_digest(newdist))
  }
  <bytecode: 0x55d7b47e4ce0>
  <environment: namespace:optmatch>
   --- function search by body ---
  Function optmatch_same_distance in namespace optmatch has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Fatal error: the condition has length > 1