% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sandbox.R
\name{with_example}
\alias{with_example}
\title{Run Code Inside a Temporary Example Project}
\usage{
with_example(code, mismatch = FALSE)
}
\arguments{
\item{code}{Code to evaluate inside the temporary example project.}

\item{mismatch}{Logical. If TRUE, replaces the active snapshot with a
mismatched version before evaluating \code{code}.}
}
\value{
The value of \code{code}.
}
\description{
Creates a self-contained example project under \code{tempdir()}, including:
\itemize{
\item \code{_resultcheck.yml} (project root marker)
\item \code{analysis.R} with \code{snapshot(model, "model")}
\item matching and mismatched snapshot files
\item \code{tests/testthat/test-analysis.R}
}
then temporarily sets the working directory to that project while
evaluating \code{code}.
}
\examples{
with_example({
  root <- find_root()
  print(root)
})
}
