Running 'testthat.R' [11s/14s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
  > library(testthat)
  > library(metaSEM)
  Loading required package: OpenMx
  "SLSQP" is set as the default optimizer in OpenMx.
  mxOption(NULL, "Gradient algorithm") is set at "central".
  mxOption(NULL, "Optimality tolerance") is set at "6.3e-14".
  mxOption(NULL, "Gradient iterations") is set at "2".
  > 
  > test_check("metaSEM")
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  metaSEM
   --- call from context --- 
  Diag(x)
   --- call from argument --- 
  if (class(x) == "character" & missing(...)) {
      p <- length(x)
      out <- matrix(0, nrow = p, ncol = p)
      diag(out) <- x
  } else {
      out <- diag(x, ...)
  }
   --- R stacktrace ---
  where 1: Diag(x)
  where 2: is.pd(x1)
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test_utilities.R#30: expect_true(is.pd(x1))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test_utilities.R#23: test_that("is.pd() works correctly", {
      x1 <- diag(1, 4)
      x2 <- matrix(c(1, 2, 2, 1), ncol = 2)
      x3 <- diag(1, 4)
      x3[1, 2] <- x3[2, 1] <- NA
      expect_true(is.pd(x1))
      expect_false(is.pd(x2))
      expect_identical(is.pd(x3), NA)
      expect_identical(is.pd(list(x1, x2, x3)), c(TRUE, FALSE, 
          NA))
  })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("metaSEM")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (x, ...) 
  {
      if (class(x) == "character" & missing(...)) {
          p <- length(x)
          out <- matrix(0, nrow = p, ncol = p)
          diag(out) <- x
      }
      else {
          out <- diag(x, ...)
      }
      out
  }
  <bytecode: 0x8265a98>
  <environment: namespace:metaSEM>
   --- function search by body ---
  Function Diag in namespace metaSEM has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 1. Error: is.pd() works correctly (@test_utilities.R#30)  -------------------
  the condition has length > 1
  Backtrace:
   1. testthat::expect_true(is.pd(x1))
   4. metaSEM::is.pd(x1)
   5. metaSEM::Diag(x)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  metaSEM
   --- call from context --- 
  Diag(Amatrix$free)
   --- call from argument --- 
  if (class(x) == "character" & missing(...)) {
      p <- length(x)
      out <- matrix(0, nrow = p, ncol = p)
      diag(out) <- x
  } else {
      out <- diag(x, ...)
  }
   --- R stacktrace ---
  where 1: Diag(Amatrix$free)
  where 2: checkRAM(Amatrix = A1)
  where 3: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
  where 4: withVisible(code)
  where 5: withCallingHandlers(withVisible(code), warning = handle_warning, 
      message = handle_message)
  where 6: force(code)
  where 7: withr::with_output_sink(temp, withCallingHandlers(withVisible(code), 
      warning = handle_warning, message = handle_message))
  where 8: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)), 
      ...)
  where 9: quasi_capture(enquo(object), NULL, evaluate_promise)
  where 10 at testthat/test_utilities.R#274: expect_silent(checkRAM(Amatrix = A1))
  where 11: eval(code, test_env)
  where 12: eval(code, test_env)
  where 13: 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 14: doTryCatch(return(expr), name, parentenv, handler)
  where 15: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 16: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 17: doTryCatch(return(expr), name, parentenv, handler)
  where 18: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 19: tryCatchList(expr, classes, parentenv, handlers)
  where 20: 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 21: test_code(desc, code, env = parent.frame())
  where 22 at testthat/test_utilities.R#266: test_that("checkRAM() works correctly", {
      A1 <- matrix(c("0", "0", "0", "1*a", "0", "0", "1*b", "1*c", 
          "0"), nrow = 3, ncol = 3, byrow = TRUE)
      expect_silent(checkRAM(Amatrix = A1))
      expect_silent(checkRAM(Amatrix = as.mxMatrix(A1)))
      A2 <- matrix(c("0", "0", "0", "1*a", "1", "0", "1*b", "1*c", 
          "0"), nrow = 3, ncol = 3, byrow = TRUE)
      expect_warning(checkRAM(Amatrix = A2))
      expect_warning(checkRAM(Amatrix = as.mxMatrix(A2)))
      A3 <- matrix(c("0", "0", "0", "1*a", "0*d", "0", "1*b", "1*c", 
          "0"), nrow = 3, ncol = 3, byrow = TRUE)
      expect_warning(checkRAM(Amatrix = A3))
      expect_warning(checkRAM(Amatrix = as.mxMatrix(A3)))
      A4 <- matrix(c("0", "0*d", "0", "1*a", "0", "0", "1*b", "1*c", 
          "0"), nrow = 3, ncol = 3, byrow = TRUE)
      expect_warning(checkRAM(Amatrix = A4))
      expect_warning(checkRAM(Amatrix = as.mxMatrix(A4)))
      S1 <- matrix(c("1", "0", "0", "0", "0*a", "0*b", "0", "0*b", 
          "0*c"), nrow = 3, ncol = 3, byrow = TRUE)
      expect_silent(checkRAM(Smatrix = S1, cor.analysis = TRUE))
      expect_silent(checkRAM(Smatrix = as.mxMatrix(S1), cor.analysis = TRUE))
      expect_silent(checkRAM(Smatrix = S1, cor.analysis = FALSE))
      expect_silent(checkRAM(Smatrix = as.mxMatrix(S1), cor.analysis = FALSE))
      S2 <- matrix(c("1", "0", "0", "0", "0*a", "0*b1", "0", "0*b2", 
          "0*c"), nrow = 3, ncol = 3, byrow = TRUE)
      expect_warning(checkRAM(Smatrix = S2, cor.analysis = TRUE))
      expect_warning(checkRAM(Smatrix = as.mxMatrix(S2), cor.analysis = TRUE))
      expect_warning(checkRAM(Smatrix = S2, cor.analysis = FALSE))
      expect_warning(checkRAM(Smatrix = as.mxMatrix(S2), cor.analysis = FALSE))
      S3 <- matrix(c("1", "0", "0", "1", "0*a", "0*b", "0", "0*b", 
          "0*c"), nrow = 3, ncol = 3, byrow = TRUE)
      expect_warning(checkRAM(Smatrix = S3, cor.analysis = TRUE))
      expect_warning(checkRAM(Smatrix = as.mxMatrix(S3), cor.analysis = TRUE))
      expect_warning(checkRAM(Smatrix = S3, cor.analysis = FALSE))
      expect_warning(checkRAM(Smatrix = as.mxMatrix(S3), cor.analysis = FALSE))
      S4 <- matrix(c("1", "0", "0", "1*d", "0*a", "0*b", "0", "0*b", 
          "0*c"), nrow = 3, ncol = 3, byrow = TRUE)
      expect_warning(checkRAM(Smatrix = S4, cor.analysis = TRUE))
      expect_warning(checkRAM(Smatrix = as.mxMatrix(S4), cor.analysis = TRUE))
      expect_warning(checkRAM(Smatrix = S4, cor.analysis = FALSE))
      expect_warning(checkRAM(Smatrix = as.mxMatrix(S4), cor.analysis = FALSE))
      expect_silent(checkRAM(A = A1, S = S1, cor.analysis = TRUE))
      S5 <- matrix(c("1*Err_IV", "0", "0", "0", "0*a", "0*b", "0", 
          "0*b", "0*c"), nrow = 3, ncol = 3, byrow = TRUE)
      expect_warning(checkRAM(Amatrix = A1, Smatrix = S5, cor.analysis = TRUE))
      expect_silent(checkRAM(Amatrix = A1, Smatrix = S5, cor.analysis = FALSE))
      S6 <- matrix(c("0", "0", "0", "0", "0*a", "0*b", "0", "0*b", 
          "0*c"), nrow = 3, ncol = 3, byrow = TRUE)
      expect_warning(checkRAM(Amatrix = A1, Smatrix = S6, cor.analysis = TRUE))
      expect_silent(checkRAM(Amatrix = A1, Smatrix = S6, cor.analysis = FALSE))
  })
  where 23: eval(code, test_env)
  where 24: eval(code, test_env)
  where 25: 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 26: doTryCatch(return(expr), name, parentenv, handler)
  where 27: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 28: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 29: doTryCatch(return(expr), name, parentenv, handler)
  where 30: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 31: tryCatchList(expr, classes, parentenv, handlers)
  where 32: 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 33: test_code(NULL, exprs, env)
  where 34: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 35: force(code)
  where 36: doWithOneRestart(return(expr), restart)
  where 37: withOneRestart(expr, restarts[[1L]])
  where 38: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 39: 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 40: FUN(X[[i]], ...)
  where 41: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 42: force(code)
  where 43: doWithOneRestart(return(expr), restart)
  where 44: withOneRestart(expr, restarts[[1L]])
  where 45: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 46: 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 47: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 48: 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 49: 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 50: test_check("metaSEM")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (x, ...) 
  {
      if (class(x) == "character" & missing(...)) {
          p <- length(x)
          out <- matrix(0, nrow = p, ncol = p)
          diag(out) <- x
      }
      else {
          out <- diag(x, ...)
      }
      out
  }
  <bytecode: 0x8265a98>
  <environment: namespace:metaSEM>
   --- function search by body ---
  Function Diag in namespace metaSEM has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 2. Error: checkRAM() works correctly (@test_utilities.R#274)  ---------------
  the condition has length > 1
  Backtrace:
    1. testthat::expect_silent(checkRAM(Amatrix = A1))
    9. metaSEM::checkRAM(Amatrix = A1)
   10. metaSEM::Diag(Amatrix$free)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  metaSEM
   --- call from context --- 
  Diag(Amatrix$free)
   --- call from argument --- 
  if (class(x) == "character" & missing(...)) {
      p <- length(x)
      out <- matrix(0, nrow = p, ncol = p)
      diag(out) <- x
  } else {
      out <- diag(x, ...)
  }
   --- R stacktrace ---
  where 1: Diag(Amatrix$free)
  where 2: checkRAM(Amatrix, Smatrix, cor.analysis = FALSE)
  where 3 at testthat/test_utilities.R#470: create.mxModel(RAM = RAM1, data = Jaramillo05)
  where 4: eval(code, test_env)
  where 5: eval(code, test_env)
  where 6: 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 7: doTryCatch(return(expr), name, parentenv, handler)
  where 8: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 9: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 10: doTryCatch(return(expr), name, parentenv, handler)
  where 11: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 12: tryCatchList(expr, classes, parentenv, handlers)
  where 13: 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 14: test_code(desc, code, env = parent.frame())
  where 15 at testthat/test_utilities.R#454: test_that("metaFIML() works correctly", {
      fit1a <- metaFIML(y = r, v = r_v, x = JP_alpha, data = Jaramillo05)
      m1 <- "fy =~ 1*r\n           r ~~ data.r_v*r\n           fx =~ 1*JP_alpha\n           JP_alpha ~~ 0*JP_alpha\n           fy ~ Slope1_1*fx\n           fy ~~ Tau2_1_1*fy\n           fx ~~ CovX1_X1*fx\n           fx ~ MeanX1*1\n           fy ~ Intercept1*1"
      RAM1 <- lavaan2RAM(m1, obs.variables = c("r", "JP_alpha"), 
          std.lv = FALSE)
      fit1b <- create.mxModel(RAM = RAM1, data = Jaramillo05)
      coef1a <- coef(fit1a)
      names1 <- names(coef1a)
      coef1b <- coef(fit1b)[names1]
      tolerance <- 0.001
      expect_equal(coef1a, coef1b, tolerance = tolerance)
      expect_equal(vcov(fit1a), vcov(fit1b)[names1, names1], tolerance = tolerance)
      expect_equal(fit1a$mx.fit$output$Minus2LogLikelihood, fit1b$output$Minus2LogLikelihood)
      fit2a <- metaFIML(y = r, v = r_v, x = JP_alpha, av = IDV, 
          data = Jaramillo05)
      m2 <- "fy =~ 1*r\n           r ~~ data.r_v*r\n           fx =~ 1*JP_alpha\n           JP_alpha ~~ 0*JP_alpha\n           fy ~ Slope1_1*fx\n           fy ~~ Tau2_1_1*fy\n           fx ~~ CovX1_X1*fx\n           fx ~ MeanX1*1\n           fy ~ Intercept1*1\n\n           fz =~ 1*IDV\n           IDV ~~ 0*IDV\n           fz ~ MeanX2*1\n           fz ~~ CovX2_X2*fz + start(818)*fz\n           fx ~~ CovX2_X1*fz\n           fy ~~ CovX2_Y1*fz"
      RAM2 <- lavaan2RAM(m2, obs.variables = c("r", "JP_alpha", 
          "IDV"), std.lv = FALSE)
      fit2b <- create.mxModel(RAM = RAM2, data = Jaramillo05)
      coef2a <- coef(fit2a)
      names2 <- names(coef2a)
      coef2b <- coef(fit2b)[names2]
      expect_equal(coef2a, coef2b, tolerance = tolerance)
      v_fit2a <- vcov(fit2a)[-4, -4]
      v_fit2b <- vcov(fit2b)[names2, names2][-4, -4]
      expect_equal(v_fit2a, v_fit2b, tolerance = tolerance)
      expect_equal(fit2a$mx.fit$output$Minus2LogLikelihood, fit2b$output$Minus2LogLikelihood)
      wvs94a$gnp <- scale(wvs94a$gnp)
      fit3a <- metaFIML(y = cbind(lifesat, lifecon), v = cbind(lifesat_var, 
          inter_cov, lifecon_var), x = gnp, data = wvs94a)
      m3 <- "fy1 =~ 1*lifesat\n           lifesat ~~ data.lifesat_var*lifesat\n           fy2 =~ 1*lifecon\n           lifecon ~~ data.lifecon_var*lifecon\n           lifesat ~~ data.inter_cov*lifecon\n\n           fx =~ 1*gnp\n           gnp ~~ 0*gnp\n           fy1 ~ Slope1_1*fx\n           fy2 ~ Slope2_1*fx\n\n           fy1 ~~ Tau2_1_1*fy1\n           fy2 ~~ Tau2_2_2*fy2\n           fy1 ~~ Tau2_2_1*fy2\n           fx ~~ CovX1_X1*fx\n           fx ~ MeanX1*1\n           fy1 ~ Intercept1*1\n           fy2 ~ Intercept2*1"
      RAM3 <- lavaan2RAM(m3, obs.variables = c("lifesat", "lifecon", 
          "gnp"), std.lv = FALSE)
      fit3b <- create.mxModel(RAM = RAM3, data = wvs94a)
      coef3a <- coef(fit3a)
      names3 <- names(coef3a)
      coef3b <- coef(fit3b)[names3]
      expect_equal(coef3a, coef3b, tolerance = tolerance)
      expect_equal(vcov(fit3a), vcov(fit3b)[names3, names3], tolerance = tolerance)
      expect_equal(fit3a$mx.fit$output$Minus2LogLikelihood, fit3b$output$Minus2LogLikelihood)
  })
  where 16: eval(code, test_env)
  where 17: eval(code, test_env)
  where 18: 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 19: doTryCatch(return(expr), name, parentenv, handler)
  where 20: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 21: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 22: doTryCatch(return(expr), name, parentenv, handler)
  where 23: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 24: tryCatchList(expr, classes, parentenv, handlers)
  where 25: 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 26: test_code(NULL, exprs, env)
  where 27: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 28: force(code)
  where 29: doWithOneRestart(return(expr), restart)
  where 30: withOneRestart(expr, restarts[[1L]])
  where 31: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 32: 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 33: FUN(X[[i]], ...)
  where 34: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 35: force(code)
  where 36: doWithOneRestart(return(expr), restart)
  where 37: withOneRestart(expr, restarts[[1L]])
  where 38: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 39: 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 40: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 41: 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 42: 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 43: test_check("metaSEM")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (x, ...) 
  {
      if (class(x) == "character" & missing(...)) {
          p <- length(x)
          out <- matrix(0, nrow = p, ncol = p)
          diag(out) <- x
      }
      else {
          out <- diag(x, ...)
      }
      out
  }
  <bytecode: 0x8265a98>
  <environment: namespace:metaSEM>
   --- function search by body ---
  Function Diag in namespace metaSEM has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 3. Error: metaFIML() works correctly (@test_utilities.R#470)  ---------------
  the condition has length > 1
  Backtrace:
   1. metaSEM::create.mxModel(RAM = RAM1, data = Jaramillo05)
   2. metaSEM::checkRAM(Amatrix, Smatrix, cor.analysis = FALSE)
   3. metaSEM::Diag(Amatrix$free)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  metaSEM
   --- call from context --- 
  Diag(x)
   --- call from argument --- 
  if (class(x) == "character" & missing(...)) {
      p <- length(x)
      out <- matrix(0, nrow = p, ncol = p)
      diag(out) <- x
  } else {
      out <- diag(x, ...)
  }
   --- R stacktrace ---
  where 1: Diag(x)
  where 2: FUN(X[[i]], ...)
  where 3: lapply(X = X, FUN = FUN, ...)
  where 4: sapply(x, is.pd, check.aCov = check.aCov, cor.analysis = cor.analysis, 
      tol = tol)
  where 5: is.pd(Cov)
  where 6: tssem1FEM(Cov = Cov, n = n, cor.analysis = cor.analysis, model.name = model.name, 
      cluster = cluster, suppressWarnings = suppressWarnings, silent = silent, 
      run = run, ...)
  where 7 at testthat/test_utilities.R#577: tssem1(Cov = list(C1, C2, C3), n = c(50, 50, 50), method = "FEM")
  where 8: eval(code, test_env)
  where 9: eval(code, test_env)
  where 10: 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 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 13: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 14: doTryCatch(return(expr), name, parentenv, handler)
  where 15: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 16: tryCatchList(expr, classes, parentenv, handlers)
  where 17: 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 18: test_code(desc, code, env = parent.frame())
  where 19 at testthat/test_utilities.R#558: test_that("Handling NA in diagonals in tssem1FEM() correctly", 
      {
          var.names <- paste0("x", 1:4)
          C1 <- matrix(0.5, ncol = 4, nrow = 4)
          diag(C1) <- 1
          C2 <- matrix(0.5, ncol = 4, nrow = 4)
          C2[2, ] <- C2[, 2] <- NA
          diag(C2) <- 1
          C3 <- matrix(0.5, ncol = 4, nrow = 4)
          C3[1, ] <- C3[, 1] <- NA
          diag(C3) <- 1
          dimnames(C1) <- dimnames(C2) <- dimnames(C3) <- list(var.names, 
              var.names)
          C2.NA <- C2
          C2.NA[2, 2] <- NA
          C3.NA <- C3
          C3.NA[1, 1] <- NA
          fit <- tssem1(Cov = list(C1, C2, C3), n = c(50, 50, 50), 
              method = "FEM")
          expect_identical(list(C1, C2.NA, C3.NA), fit$data)
          C2[2, 3] <- C2[3, 2] <- 0.5
          C3[1, 2] <- C3[2, 1] <- 0.5
          expect_error(tssem1(Cov = list(C1, C2, C3), n = c(50, 
              50, 50), method = "FEM"))
      })
  where 20: eval(code, test_env)
  where 21: eval(code, test_env)
  where 22: 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 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 25: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 26: doTryCatch(return(expr), name, parentenv, handler)
  where 27: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 28: tryCatchList(expr, classes, parentenv, handlers)
  where 29: 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 30: test_code(NULL, exprs, env)
  where 31: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 32: force(code)
  where 33: doWithOneRestart(return(expr), restart)
  where 34: withOneRestart(expr, restarts[[1L]])
  where 35: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 36: 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 37: FUN(X[[i]], ...)
  where 38: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 39: force(code)
  where 40: doWithOneRestart(return(expr), restart)
  where 41: withOneRestart(expr, restarts[[1L]])
  where 42: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 43: 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 44: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 45: 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 46: 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 47: test_check("metaSEM")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (x, ...) 
  {
      if (class(x) == "character" & missing(...)) {
          p <- length(x)
          out <- matrix(0, nrow = p, ncol = p)
          diag(out) <- x
      }
      else {
          out <- diag(x, ...)
      }
      out
  }
  <bytecode: 0x8265a98>
  <environment: namespace:metaSEM>
   --- function search by body ---
  Function Diag in namespace metaSEM has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 4. Error: Handling NA in diagonals in tssem1FEM() correctly (@test_utilities.
  the condition has length > 1
  Backtrace:
   1. metaSEM::tssem1(Cov = list(C1, C2, C3), n = c(50, 50, 50), method = "FEM")
   2. metaSEM::tssem1FEM(...)
   3. metaSEM::is.pd(Cov)
   4. base::sapply(...)
   5. base::lapply(X = X, FUN = FUN, ...)
   6. metaSEM:::FUN(X[[i]], ...)
   7. metaSEM::Diag(x)
  
  == testthat results  ===========================================================
  [ OK: 50 | SKIPPED: 0 | WARNINGS: 0 | FAILED: 4 ]
  1. Error: is.pd() works correctly (@test_utilities.R#30) 
  2. Error: checkRAM() works correctly (@test_utilities.R#274) 
  3. Error: metaFIML() works correctly (@test_utilities.R#470) 
  4. Error: Handling NA in diagonals in tssem1FEM() correctly (@test_utilities.R#577) 
  
  Error: testthat unit tests failed
  Execution halted