# A deliberately incorrect engine that accepts weights but ignores them.
bad_engine <- function(formula, data, family = NULL, weights = NULL) {
  if (is.null(family)) {
    stats::lm(formula, data = data, model = TRUE, x = TRUE, y = TRUE)
  } else {
    stats::glm(formula, data = data, family = family, model = TRUE, x = TRUE, y = TRUE)
  }
}

weighted_data <- transform(mtcars, audit_weight = seq_len(nrow(mtcars)))

# The weight-semantics test should fail.
statwitness::statwitness(
  mpg ~ wt + hp,
  data = weighted_data,
  focus = "wt",
  weights = audit_weight,
  engine = bad_engine
)
