mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
don't write to (temp) file in solve tests
This commit is contained in:
parent
a4c8ebd55e
commit
52b58ecdf3
2 changed files with 28 additions and 6 deletions
|
@ -105,6 +105,31 @@ pub fn load_and_typecheck<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
pub fn load_and_typecheck_str<'a>(
|
||||
arena: &'a Bump,
|
||||
filename: PathBuf,
|
||||
source: &'a str,
|
||||
src_dir: &Path,
|
||||
exposed_types: ExposedByModule,
|
||||
target_info: TargetInfo,
|
||||
) -> Result<LoadedModule, LoadingProblem<'a>> {
|
||||
use LoadResult::*;
|
||||
|
||||
let load_start = LoadStart::from_str(arena, filename, source)?;
|
||||
|
||||
match load(
|
||||
arena,
|
||||
load_start,
|
||||
src_dir,
|
||||
exposed_types,
|
||||
Phase::SolveTypes,
|
||||
target_info,
|
||||
)? {
|
||||
Monomorphized(_) => unreachable!(""),
|
||||
TypeChecked(module) => Ok(module),
|
||||
}
|
||||
}
|
||||
|
||||
const BOOL: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/Bool.dat")) as &[_];
|
||||
const RESULT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/Result.dat")) as &[_];
|
||||
const LIST: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/List.dat")) as &[_];
|
||||
|
|
|
@ -48,13 +48,10 @@ mod solve_expr {
|
|||
let dir = tempdir()?;
|
||||
let filename = PathBuf::from("Test.roc");
|
||||
let file_path = dir.path().join(filename);
|
||||
let full_file_path = file_path.clone();
|
||||
let mut file = File::create(file_path)?;
|
||||
writeln!(file, "{}", module_src)?;
|
||||
drop(file);
|
||||
let result = roc_load::load_and_typecheck(
|
||||
let result = roc_load::load_and_typecheck_str(
|
||||
arena,
|
||||
full_file_path,
|
||||
file_path,
|
||||
module_src,
|
||||
dir.path(),
|
||||
exposed_types,
|
||||
roc_target::TargetInfo::default_x86_64(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue