Get tests compiling again

This commit is contained in:
Richard Feldman 2020-08-02 21:00:33 -04:00
parent 62459d0f1f
commit cb843c37e7

View File

@ -14,7 +14,6 @@ mod helpers;
#[cfg(test)]
mod test_load {
use crate::helpers::fixtures_dir;
use bumpalo::Bump;
use inlinable_string::InlinableString;
use roc_can::def::Declaration::*;
use roc_can::def::Def;
@ -28,19 +27,17 @@ mod test_load {
// HELPERS
fn load_fixture<'a>(
arena: &'a Bump,
fn load_fixture(
dir_name: &str,
module_name: &str,
subs_by_module: SubsByModule,
) -> LoadedModule<'a> {
) -> LoadedModule {
let src_dir = fixtures_dir().join(dir_name);
let filename = src_dir.join(format!("{}.roc", module_name));
let loaded = load(
&arena,
&roc_builtins::std::standard_stdlib(),
src_dir,
filename,
&roc_builtins::std::standard_stdlib(),
filename.as_path(),
subs_by_module,
);
let loaded_module = loaded.expect("Test module failed to load");
@ -131,12 +128,10 @@ mod test_load {
let subs_by_module = MutMap::default();
let src_dir = fixtures_dir().join("interface_with_deps");
let filename = src_dir.join("Primary.roc");
let arena = Bump::new();
let loaded = load(
&arena,
&roc_builtins::std::standard_stdlib(),
src_dir,
filename,
&roc_builtins::std::standard_stdlib(),
filename.as_path(),
subs_by_module,
);
@ -165,9 +160,8 @@ mod test_load {
#[test]
fn load_unit() {
let arena = Bump::new();
let subs_by_module = MutMap::default();
let loaded_module = load_fixture(&arena, "no_deps", "Unit", subs_by_module);
let loaded_module = load_fixture("no_deps", "Unit", subs_by_module);
expect_types(
loaded_module,
@ -179,10 +173,8 @@ mod test_load {
#[test]
fn import_alias() {
let arena = Bump::new();
let subs_by_module = MutMap::default();
let loaded_module =
load_fixture(&arena, "interface_with_deps", "ImportAlias", subs_by_module);
let loaded_module = load_fixture("interface_with_deps", "ImportAlias", subs_by_module);
expect_types(
loaded_module,
@ -194,14 +186,8 @@ mod test_load {
#[test]
fn load_and_typecheck() {
let arena = Bump::new();
let subs_by_module = MutMap::default();
let loaded_module = load_fixture(
&arena,
"interface_with_deps",
"WithBuiltins",
subs_by_module,
);
let loaded_module = load_fixture("interface_with_deps", "WithBuiltins", subs_by_module);
expect_types(
loaded_module,
@ -220,10 +206,8 @@ mod test_load {
#[test]
fn iface_quicksort() {
let arena = Bump::new();
let subs_by_module = MutMap::default();
let loaded_module =
load_fixture(&arena, "interface_with_deps", "Quicksort", subs_by_module);
let loaded_module = load_fixture("interface_with_deps", "Quicksort", subs_by_module);
expect_types(
loaded_module,
@ -237,9 +221,8 @@ mod test_load {
#[test]
fn app_quicksort() {
let arena = Bump::new();
let subs_by_module = MutMap::default();
let loaded_module = load_fixture(&arena, "app_with_deps", "Quicksort", subs_by_module);
let loaded_module = load_fixture("app_with_deps", "Quicksort", subs_by_module);
expect_types(
loaded_module,
@ -253,9 +236,8 @@ mod test_load {
#[test]
fn load_astar() {
let arena = Bump::new();
let subs_by_module = MutMap::default();
let loaded_module = load_fixture(&arena, "interface_with_deps", "AStar", subs_by_module);
let loaded_module = load_fixture("interface_with_deps", "AStar", subs_by_module);
expect_types(
loaded_module,
@ -272,9 +254,8 @@ mod test_load {
#[test]
fn load_principal_types() {
let arena = Bump::new();
let subs_by_module = MutMap::default();
let loaded_module = load_fixture(&arena, "no_deps", "Principal", subs_by_module);
let loaded_module = load_fixture("no_deps", "Principal", subs_by_module);
expect_types(
loaded_module,
@ -287,9 +268,8 @@ mod test_load {
#[test]
fn iface_dep_types() {
let arena = Bump::new();
let subs_by_module = MutMap::default();
let loaded_module = load_fixture(&arena, "interface_with_deps", "Primary", subs_by_module);
let loaded_module = load_fixture("interface_with_deps", "Primary", subs_by_module);
expect_types(
loaded_module,
@ -310,9 +290,8 @@ mod test_load {
#[test]
fn app_dep_types() {
let arena = Bump::new();
let subs_by_module = MutMap::default();
let loaded_module = load_fixture(&arena, "app_with_deps", "Primary", subs_by_module);
let loaded_module = load_fixture("app_with_deps", "Primary", subs_by_module);
expect_types(
loaded_module,
@ -333,9 +312,8 @@ mod test_load {
#[test]
fn imported_dep_regression() {
let arena = Bump::new();
let subs_by_module = MutMap::default();
let loaded_module = load_fixture(&arena, "interface_with_deps", "OneDep", subs_by_module);
let loaded_module = load_fixture("interface_with_deps", "OneDep", subs_by_module);
expect_types(
loaded_module,