mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
update the tests
This commit is contained in:
parent
c663a35e16
commit
b9c318e9fb
13 changed files with 29 additions and 18 deletions
|
@ -28,6 +28,8 @@ mod test_load {
|
|||
use roc_types::subs::Subs;
|
||||
use std::collections::HashMap;
|
||||
|
||||
const TARGET_INFO: roc_target::TargetInfo = roc_target::TargetInfo::default_x86_64();
|
||||
|
||||
// HELPERS
|
||||
|
||||
fn multiple_modules(files: Vec<(&str, &str)>) -> Result<LoadedModule, String> {
|
||||
|
@ -110,7 +112,7 @@ mod test_load {
|
|||
arena.alloc(stdlib),
|
||||
dir.path(),
|
||||
exposed_types,
|
||||
8,
|
||||
TARGET_INFO,
|
||||
builtin_defs_map,
|
||||
)
|
||||
};
|
||||
|
@ -134,7 +136,7 @@ mod test_load {
|
|||
arena.alloc(roc_builtins::std::standard_stdlib()),
|
||||
src_dir.as_path(),
|
||||
subs_by_module,
|
||||
8,
|
||||
TARGET_INFO,
|
||||
builtin_defs_map,
|
||||
);
|
||||
let mut loaded_module = match loaded {
|
||||
|
@ -305,7 +307,7 @@ mod test_load {
|
|||
arena.alloc(roc_builtins::std::standard_stdlib()),
|
||||
src_dir.as_path(),
|
||||
subs_by_module,
|
||||
8,
|
||||
TARGET_INFO,
|
||||
builtin_defs_map,
|
||||
);
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ roc_builtins = { path = "../builtins" }
|
|||
roc_problem = { path = "../problem" }
|
||||
roc_parse = { path = "../parse" }
|
||||
roc_solve = { path = "../solve" }
|
||||
roc_target = { path = "../target" }
|
||||
pretty_assertions = "1.0.0"
|
||||
indoc = "1.0.3"
|
||||
tempfile = "3.2.0"
|
||||
|
|
|
@ -63,7 +63,7 @@ mod solve_expr {
|
|||
&stdlib,
|
||||
dir.path(),
|
||||
exposed_types,
|
||||
8,
|
||||
roc_target::TargetInfo::default_x86_64(),
|
||||
builtin_defs_map,
|
||||
);
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ roc_load = { path = "../load" }
|
|||
roc_can = { path = "../can" }
|
||||
roc_parse = { path = "../parse" }
|
||||
roc_build = { path = "../build" }
|
||||
roc_target = { path = "../target" }
|
||||
roc_std = { path = "../../roc_std" }
|
||||
bumpalo = { version = "3.8.0", features = ["collections"] }
|
||||
either = "1.6.1"
|
||||
|
|
|
@ -23,9 +23,9 @@ fn width_and_alignment_u8_u8() {
|
|||
|
||||
let layout = Layout::Union(UnionLayout::NonRecursive(&tt));
|
||||
|
||||
let ptr_width = 8;
|
||||
assert_eq!(layout.alignment_bytes(ptr_width), 1);
|
||||
assert_eq!(layout.stack_size(ptr_width), 2);
|
||||
let target_info = roc_target::TargetInfo::default_x86_64();
|
||||
assert_eq!(layout.alignment_bytes(target_info), 1);
|
||||
assert_eq!(layout.stack_size(target_info), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -57,7 +57,7 @@ pub fn helper(
|
|||
&stdlib,
|
||||
src_dir,
|
||||
exposed_types,
|
||||
8,
|
||||
roc_target::TargetInfo::default_x86_64(),
|
||||
builtin_defs_map,
|
||||
);
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@ fn create_llvm_module<'a>(
|
|||
) -> (&'static str, String, &'a Module<'a>) {
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
let target_info = roc_target::TargetInfo::from(target);
|
||||
|
||||
let filename = PathBuf::from("Test.roc");
|
||||
let src_dir = Path::new("fake/test/path");
|
||||
|
||||
|
@ -56,8 +58,6 @@ fn create_llvm_module<'a>(
|
|||
module_src = &temp;
|
||||
}
|
||||
|
||||
let ptr_bytes = target.pointer_width().unwrap().bytes() as u32;
|
||||
|
||||
let exposed_types = MutMap::default();
|
||||
let loaded = roc_load::file::load_and_monomorphize_from_str(
|
||||
arena,
|
||||
|
@ -66,7 +66,7 @@ fn create_llvm_module<'a>(
|
|||
stdlib,
|
||||
src_dir,
|
||||
exposed_types,
|
||||
ptr_bytes,
|
||||
target_info,
|
||||
test_builtin_defs,
|
||||
);
|
||||
|
||||
|
@ -213,7 +213,7 @@ fn create_llvm_module<'a>(
|
|||
context,
|
||||
interns,
|
||||
module,
|
||||
target_info: ptr_bytes,
|
||||
target_info,
|
||||
is_gen_test,
|
||||
// important! we don't want any procedures to get the C calling convention
|
||||
exposed_to_host: MutSet::default(),
|
||||
|
|
|
@ -94,7 +94,6 @@ fn compile_roc_to_wasm_bytes<'a, T: Wasm32TestResult>(
|
|||
}
|
||||
|
||||
let exposed_types = MutMap::default();
|
||||
let ptr_bytes = 4;
|
||||
let loaded = roc_load::file::load_and_monomorphize_from_str(
|
||||
arena,
|
||||
filename,
|
||||
|
@ -102,7 +101,7 @@ fn compile_roc_to_wasm_bytes<'a, T: Wasm32TestResult>(
|
|||
stdlib,
|
||||
src_dir,
|
||||
exposed_types,
|
||||
ptr_bytes,
|
||||
roc_target::TargetInfo::default_wasm32(),
|
||||
builtin_defs_map,
|
||||
);
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ roc_builtins = { path = "../builtins" }
|
|||
roc_load = { path = "../load" }
|
||||
roc_can = { path = "../can" }
|
||||
roc_mono = { path = "../mono" }
|
||||
roc_target = { path = "../target" }
|
||||
test_mono_macros = { path = "../test_mono_macros" }
|
||||
pretty_assertions = "1.0.0"
|
||||
bumpalo = { version = "3.8.0", features = ["collections"] }
|
||||
|
|
|
@ -25,6 +25,8 @@ use roc_mono::ir::Proc;
|
|||
|
||||
use roc_mono::ir::ProcLayout;
|
||||
|
||||
const TARGET_INFO: roc_target::TargetInfo = roc_target::TargetInfo::default_x86_64();
|
||||
|
||||
/// Without this, some tests pass in `cargo test --release` but fail without
|
||||
/// the --release flag because they run out of stack space. This increases
|
||||
/// stack size for debug builds only, while leaving the stack space at the default
|
||||
|
@ -104,7 +106,7 @@ fn compiles_to_ir(test_name: &str, src: &str) {
|
|||
&stdlib,
|
||||
src_dir,
|
||||
exposed_types,
|
||||
8,
|
||||
TARGET_INFO,
|
||||
builtin_defs_map,
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue