Make test crates only have dev dependencies and separate out wasm memory helper

This commit is contained in:
Brendan Hansknecht 2021-11-07 18:01:40 -08:00
parent c46b56bec8
commit 2ce945771e
10 changed files with 22 additions and 11 deletions

View file

@ -8,7 +8,7 @@ edition = "2018"
name = "test_dev" name = "test_dev"
path = "src/tests.rs" path = "src/tests.rs"
[dependencies] [dev-dependencies]
roc_collections = { path = "../collections" } roc_collections = { path = "../collections" }
roc_can = { path = "../can" } roc_can = { path = "../can" }
roc_build = { path = "../build" } roc_build = { path = "../build" }

View file

@ -9,7 +9,7 @@ edition = "2018"
name = "test_gen" name = "test_gen"
path = "src/tests.rs" path = "src/tests.rs"
[dependencies] [dev-dependencies]
roc_gen_llvm = { path = "../gen_llvm" } roc_gen_llvm = { path = "../gen_llvm" }
roc_collections = { path = "../collections" } roc_collections = { path = "../collections" }
roc_region = { path = "../region" } roc_region = { path = "../region" }
@ -27,7 +27,7 @@ roc_can = { path = "../can" }
roc_parse = { path = "../parse" } roc_parse = { path = "../parse" }
roc_build = { path = "../build" } roc_build = { path = "../build" }
roc_std = { path = "../../roc_std" } roc_std = { path = "../../roc_std" }
test_wasm = { path = "../test_wasm" } test_wasm_util = { path = "../test_wasm_util" }
im = "15.0.0" im = "15.0.0"
im-rc = "15.0.0" im-rc = "15.0.0"
bumpalo = { version = "3.8.0", features = ["collections"] } bumpalo = { version = "3.8.0", features = ["collections"] }
@ -39,9 +39,6 @@ libloading = "0.7.1"
wasmer = { version = "2.0.0", default-features = false, features = ["default-cranelift", "default-universal"] } wasmer = { version = "2.0.0", default-features = false, features = ["default-cranelift", "default-universal"] }
wasmer-wasi = "2.0.0" wasmer-wasi = "2.0.0"
tempfile = "3.2.0" tempfile = "3.2.0"
[dev-dependencies]
bumpalo = { version = "3.8.0", features = ["collections"] }
indoc = "1.0.3" indoc = "1.0.3"
[features] [features]

View file

@ -10,7 +10,7 @@ use roc_module::symbol::Symbol;
use roc_mono::ir::OptLevel; use roc_mono::ir::OptLevel;
use roc_types::subs::VarStore; use roc_types::subs::VarStore;
use target_lexicon::Triple; use target_lexicon::Triple;
use test_wasm::helpers::from_wasm32_memory::FromWasm32Memory; use test_wasm_util::from_wasm32_memory::FromWasm32Memory;
fn promote_expr_to_module(src: &str) -> String { fn promote_expr_to_module(src: &str) -> String {
let mut buffer = String::from("app \"test\" provides [ main ] to \"./platform\"\n\nmain =\n"); let mut buffer = String::from("app \"test\" provides [ main ] to \"./platform\"\n\nmain =\n");

View file

@ -8,7 +8,7 @@ edition = "2018"
name = "test_wasm" name = "test_wasm"
path = "src/tests.rs" path = "src/tests.rs"
[dependencies] [dev-dependencies]
# roc_module = { path = "../module" } # roc_module = { path = "../module" }
# roc_mono = { path = "../mono" } # roc_mono = { path = "../mono" }
@ -24,6 +24,7 @@ roc_builtins = { path = "../builtins" }
roc_load = { path = "../load" } roc_load = { path = "../load" }
roc_types = { path = "../types" } roc_types = { path = "../types" }
roc_module = { path = "../module" } roc_module = { path = "../module" }
test_wasm_util = { path = "../test_wasm_util" }
indoc = "1.0.3" indoc = "1.0.3"
libc = "0.2.106" libc = "0.2.106"
target-lexicon = "0.12.2" target-lexicon = "0.12.2"

View file

@ -2,10 +2,10 @@ use std::cell::Cell;
use std::collections::hash_map::DefaultHasher; use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use crate::helpers::from_wasm32_memory::FromWasm32Memory;
use crate::helpers::wasm32_test_result::Wasm32TestResult; use crate::helpers::wasm32_test_result::Wasm32TestResult;
use roc_can::builtins::builtin_defs_map; use roc_can::builtins::builtin_defs_map;
use roc_collections::all::{MutMap, MutSet}; use roc_collections::all::{MutMap, MutSet};
use test_wasm_util::from_wasm32_memory::FromWasm32Memory;
const TEST_WRAPPER_NAME: &str = "test_wrapper"; const TEST_WRAPPER_NAME: &str = "test_wrapper";

View file

@ -1,6 +1,5 @@
#[macro_use] #[macro_use]
pub mod eval; pub mod eval;
pub mod from_wasm32_memory;
pub mod wasm32_test_result; pub mod wasm32_test_result;
/// Used in the with_larger_debug_stack() function, for tests that otherwise /// Used in the with_larger_debug_stack() function, for tests that otherwise

View file

@ -1,11 +1,11 @@
use bumpalo::collections::Vec; use bumpalo::collections::Vec;
use crate::helpers::from_wasm32_memory::FromWasm32Memory;
use roc_gen_wasm::wasm_module::opcodes; use roc_gen_wasm::wasm_module::opcodes;
use roc_gen_wasm::wasm_module::{ use roc_gen_wasm::wasm_module::{
Align, CodeBuilder, Export, ExportType, LocalId, Signature, ValueType, WasmModule, Align, CodeBuilder, Export, ExportType, LocalId, Signature, ValueType, WasmModule,
}; };
use roc_std::{RocDec, RocList, RocOrder, RocStr}; use roc_std::{RocDec, RocList, RocOrder, RocStr};
use test_wasm_util::from_wasm32_memory::FromWasm32Memory;
pub trait Wasm32TestResult { pub trait Wasm32TestResult {
fn insert_test_wrapper<'a>( fn insert_test_wrapper<'a>(

View file

@ -0,0 +1,13 @@
[package]
name = "test_wasm_util"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
# roc_module = { path = "../module" }
# roc_mono = { path = "../mono" }
wasmer = { version = "2.0.0", default-features = false, features = ["default-cranelift", "default-universal"] }
roc_std = { path = "../../roc_std" }

View file

@ -0,0 +1 @@
pub mod from_wasm32_memory;