mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
revert separate test platform commits
This commit is contained in:
parent
a04c173178
commit
fc315f7c67
36 changed files with 134 additions and 140 deletions
18
Cargo.lock
generated
18
Cargo.lock
generated
|
@ -2427,8 +2427,6 @@ dependencies = [
|
|||
"strum",
|
||||
"target-lexicon",
|
||||
"tempfile",
|
||||
"test-platform-effects-zig",
|
||||
"test-platform-simple-zig",
|
||||
"ven_pretty",
|
||||
]
|
||||
|
||||
|
@ -3784,22 +3782,6 @@ dependencies = [
|
|||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "test-platform-effects-zig"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"roc_command_utils",
|
||||
"roc_test_utils_dir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "test-platform-simple-zig"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"roc_command_utils",
|
||||
"roc_test_utils_dir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "test_derive"
|
||||
version = "0.0.1"
|
||||
|
|
|
@ -31,8 +31,6 @@ members = [
|
|||
"crates/wasm_interp",
|
||||
"crates/language_server",
|
||||
"crates/roc_std_heap",
|
||||
"crates/test-platform-effects-zig",
|
||||
"crates/test-platform-simple-zig",
|
||||
]
|
||||
|
||||
exclude = [
|
||||
|
|
|
@ -65,8 +65,6 @@ roc_reporting = { path = "../reporting" }
|
|||
roc_target = { path = "../compiler/roc_target" }
|
||||
roc_tracing = { path = "../tracing" }
|
||||
roc_wasm_interp = { path = "../wasm_interp", optional = true }
|
||||
test-platform-effects-zig = { path = "../test-platform-effects-zig" }
|
||||
test-platform-simple-zig = { path = "../test-platform-simple-zig" }
|
||||
|
||||
ven_pretty = { path = "../vendor/pretty" }
|
||||
|
||||
|
|
|
@ -462,9 +462,39 @@ mod cli_tests {
|
|||
use super::*;
|
||||
use roc_cli::{CMD_BUILD, CMD_DEV, CMD_TEST};
|
||||
|
||||
static BUILD_PLATFORM_HOST: std::sync::Once = std::sync::Once::new();
|
||||
|
||||
/// Build the platform host once for all tests in this module
|
||||
fn build_platform_host() {
|
||||
BUILD_PLATFORM_HOST.call_once(|| {
|
||||
let cli_build = ExecCli::new(
|
||||
CMD_BUILD,
|
||||
file_from_root(
|
||||
"crates/cli/tests/test-projects/test-platform-simple-zig",
|
||||
"app.roc",
|
||||
),
|
||||
)
|
||||
.arg(BUILD_HOST_FLAG)
|
||||
.arg(SUPPRESS_BUILD_HOST_WARNING_FLAG)
|
||||
.arg(OPTIMIZE_FLAG);
|
||||
|
||||
let cli_build_out = cli_build.run();
|
||||
cli_build_out.assert_clean_success();
|
||||
|
||||
if TEST_LEGACY_LINKER {
|
||||
let cli_build_legacy = cli_build.arg(LEGACY_LINKER_FLAG);
|
||||
|
||||
let cli_build_legacy_out = cli_build_legacy.run();
|
||||
cli_build_legacy_out.assert_clean_success();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn run_multi_dep_str() {
|
||||
build_platform_host();
|
||||
|
||||
let cli_build_unoptimized = ExecCli::new(
|
||||
CMD_BUILD,
|
||||
file_from_root(
|
||||
|
@ -497,6 +527,8 @@ mod cli_tests {
|
|||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn run_multi_dep_thunk() {
|
||||
build_platform_host();
|
||||
|
||||
let cli_build_unoptimized = ExecCli::new(
|
||||
CMD_BUILD,
|
||||
file_from_root(
|
||||
|
@ -529,6 +561,8 @@ mod cli_tests {
|
|||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn run_packages() {
|
||||
build_platform_host();
|
||||
|
||||
let cli_build_unoptimized = ExecCli::new(
|
||||
CMD_BUILD,
|
||||
file_from_root(
|
||||
|
@ -562,6 +596,8 @@ mod cli_tests {
|
|||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn run_transitive_deps_app() {
|
||||
build_platform_host();
|
||||
|
||||
let cli_build = ExecCli::new(
|
||||
CMD_BUILD,
|
||||
file_from_root(
|
||||
|
@ -584,6 +620,8 @@ mod cli_tests {
|
|||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn run_transitive_and_direct_dep_app() {
|
||||
build_platform_host();
|
||||
|
||||
let cli_build = ExecCli::new(
|
||||
CMD_BUILD,
|
||||
file_from_root(
|
||||
|
@ -606,6 +644,8 @@ mod cli_tests {
|
|||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn run_double_transitive_dep_app() {
|
||||
build_platform_host();
|
||||
|
||||
let cli_build = ExecCli::new(
|
||||
CMD_BUILD,
|
||||
file_from_root(
|
||||
|
@ -628,6 +668,8 @@ mod cli_tests {
|
|||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn module_params() {
|
||||
build_platform_host();
|
||||
|
||||
let cli_dev = ExecCli::new(
|
||||
CMD_DEV,
|
||||
file_from_root("crates/cli/tests/test-projects/module_params", "app.roc"),
|
||||
|
@ -642,6 +684,8 @@ mod cli_tests {
|
|||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn module_params_arity_mismatch() {
|
||||
build_platform_host();
|
||||
|
||||
let cli_dev = ExecCli::new(
|
||||
CMD_DEV,
|
||||
file_from_root(
|
||||
|
@ -659,6 +703,8 @@ mod cli_tests {
|
|||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn module_params_bad_ann() {
|
||||
build_platform_host();
|
||||
|
||||
let cli_dev = ExecCli::new(
|
||||
CMD_DEV,
|
||||
file_from_root(
|
||||
|
@ -676,6 +722,8 @@ mod cli_tests {
|
|||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn module_params_multiline_pattern() {
|
||||
build_platform_host();
|
||||
|
||||
let cli_dev = ExecCli::new(
|
||||
CMD_DEV,
|
||||
file_from_root(
|
||||
|
@ -692,6 +740,8 @@ mod cli_tests {
|
|||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn module_params_unexpected_fn() {
|
||||
build_platform_host();
|
||||
|
||||
let cli_dev = ExecCli::new(
|
||||
CMD_DEV,
|
||||
file_from_root(
|
||||
|
@ -708,6 +758,8 @@ mod cli_tests {
|
|||
|
||||
#[test]
|
||||
fn expects_dev_failure() {
|
||||
build_platform_host();
|
||||
|
||||
let cli_dev = ExecCli::new(
|
||||
CMD_DEV,
|
||||
file_from_root("crates/cli/tests/test-projects/expects", "expects.roc"),
|
||||
|
@ -722,6 +774,8 @@ mod cli_tests {
|
|||
|
||||
#[test]
|
||||
fn expects_test_failure() {
|
||||
build_platform_host();
|
||||
|
||||
let cli_test = ExecCli::new(
|
||||
CMD_TEST,
|
||||
file_from_root("crates/cli/tests/test-projects/expects", "expects.roc"),
|
||||
|
@ -738,9 +792,39 @@ mod cli_tests {
|
|||
use super::*;
|
||||
use cli_test_utils::helpers::file_from_root;
|
||||
|
||||
static BUILD_PLATFORM_HOST: std::sync::Once = std::sync::Once::new();
|
||||
|
||||
/// Build the platform host once for all tests in this module
|
||||
fn build_platform_host() {
|
||||
BUILD_PLATFORM_HOST.call_once(|| {
|
||||
let cli_build = ExecCli::new(
|
||||
CMD_BUILD,
|
||||
file_from_root(
|
||||
"crates/cli/tests/test-projects/test-platform-effects-zig/",
|
||||
"app-stub.roc",
|
||||
),
|
||||
)
|
||||
.arg(BUILD_HOST_FLAG)
|
||||
.arg(SUPPRESS_BUILD_HOST_WARNING_FLAG)
|
||||
.arg(OPTIMIZE_FLAG);
|
||||
|
||||
let cli_build_out = cli_build.run();
|
||||
cli_build_out.assert_clean_success();
|
||||
|
||||
if TEST_LEGACY_LINKER {
|
||||
let cli_build_legacy = cli_build.arg(LEGACY_LINKER_FLAG);
|
||||
|
||||
let cli_build_legacy_out = cli_build_legacy.run();
|
||||
cli_build_legacy_out.assert_clean_success();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn interactive_effects() {
|
||||
build_platform_host();
|
||||
|
||||
let cli_build = ExecCli::new(
|
||||
CMD_BUILD,
|
||||
file_from_root("crates/cli/tests/test-projects/effectful", "print-line.roc"),
|
||||
|
@ -761,6 +845,8 @@ mod cli_tests {
|
|||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn inspect_logging() {
|
||||
build_platform_host();
|
||||
|
||||
let cli_build = ExecCli::new(
|
||||
CMD_BUILD,
|
||||
file_from_root(
|
||||
|
@ -783,6 +869,8 @@ mod cli_tests {
|
|||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn effectful_form() {
|
||||
build_platform_host();
|
||||
|
||||
let cli_build = ExecCli::new(
|
||||
roc_cli::CMD_DEV,
|
||||
file_from_root("crates/cli/tests/test-projects/effectful", "form.roc"),
|
||||
|
@ -802,6 +890,8 @@ mod cli_tests {
|
|||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn effectful_hello() {
|
||||
build_platform_host();
|
||||
|
||||
let cli_build = ExecCli::new(
|
||||
roc_cli::CMD_DEV,
|
||||
file_from_root("crates/cli/tests/test-projects/effectful/", "hello.roc"),
|
||||
|
@ -815,6 +905,8 @@ mod cli_tests {
|
|||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn effectful_loops() {
|
||||
build_platform_host();
|
||||
|
||||
let cli_build = ExecCli::new(
|
||||
roc_cli::CMD_DEV,
|
||||
file_from_root("crates/cli/tests/test-projects/effectful/", "loops.roc"),
|
||||
|
@ -828,6 +920,8 @@ mod cli_tests {
|
|||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn effectful_untyped_passed_fx() {
|
||||
build_platform_host();
|
||||
|
||||
let cli_build = ExecCli::new(
|
||||
roc_cli::CMD_DEV,
|
||||
file_from_root(
|
||||
|
@ -844,6 +938,8 @@ mod cli_tests {
|
|||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn effectful_ignore_result() {
|
||||
build_platform_host();
|
||||
|
||||
let cli_build = ExecCli::new(
|
||||
roc_cli::CMD_DEV,
|
||||
file_from_root(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
app [main!] { pf: platform "../../../../test-platform-effects-zig/main.roc" }
|
||||
app [main!] { pf: platform "../test-platform-effects-zig/main.roc" }
|
||||
|
||||
import pf.Effect
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
app [main!] { pf: platform "../../../../test-platform-effects-zig/main.roc" }
|
||||
app [main!] { pf: platform "../test-platform-effects-zig/main.roc" }
|
||||
|
||||
import pf.Effect
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
app [main!] { pf: platform "../../../../test-platform-effects-zig/main.roc" }
|
||||
app [main!] { pf: platform "../test-platform-effects-zig/main.roc" }
|
||||
|
||||
import pf.Effect
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# Shows how Roc values can be logged
|
||||
#
|
||||
app [main!] { pf: platform "../../../../test-platform-effects-zig/main.roc" }
|
||||
app [main!] { pf: platform "../test-platform-effects-zig/main.roc" }
|
||||
|
||||
import pf.Effect
|
||||
import Community
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
app [main!] { pf: platform "../../../../test-platform-effects-zig/main.roc" }
|
||||
app [main!] { pf: platform "../test-platform-effects-zig/main.roc" }
|
||||
|
||||
import pf.Effect
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
app [main!] { pf: platform "../../../../test-platform-effects-zig/main.roc" }
|
||||
app [main!] { pf: platform "../test-platform-effects-zig/main.roc" }
|
||||
|
||||
import pf.Effect
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
app [main!] { pf: platform "../../../../test-platform-effects-zig/main.roc" }
|
||||
app [main!] { pf: platform "../test-platform-effects-zig/main.roc" }
|
||||
|
||||
import pf.Effect
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
app [main] { pf: platform "../../../../test-platform-simple-zig/main.roc" }
|
||||
app [main] { pf: platform "../test-platform-simple-zig/main.roc" }
|
||||
|
||||
makeA =
|
||||
a = 1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
app [main] { pf: platform "../../../../../test-platform-simple-zig/main.roc" }
|
||||
app [main] { pf: platform "../../test-platform-simple-zig/main.roc" }
|
||||
|
||||
import Dep1
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
app [main] { pf: platform "../../../../../test-platform-simple-zig/main.roc" }
|
||||
app [main] { pf: platform "../../test-platform-simple-zig/main.roc" }
|
||||
|
||||
import Dep1
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
app [main] {
|
||||
pf: platform "../../../../../test-platform-simple-zig/main.roc",
|
||||
pf: platform "../../test-platform-simple-zig/main.roc",
|
||||
json: "json/main.roc",
|
||||
csv: "csv/main.roc",
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
app [main] {
|
||||
pf: platform "../../../../../test-platform-simple-zig/main.roc",
|
||||
pf: platform "../../test-platform-simple-zig/main.roc",
|
||||
one: "one/main.roc",
|
||||
two: "two/main.roc",
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
app [main] {
|
||||
pf: platform "../../../../../test-platform-simple-zig/main.roc",
|
||||
pf: platform "../../test-platform-simple-zig/main.roc",
|
||||
one: "one/main.roc",
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
app [main] {
|
||||
pf: platform "../../../../../test-platform-simple-zig/main.roc",
|
||||
pf: platform "../../test-platform-simple-zig/main.roc",
|
||||
zero: "zero/main.roc",
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
app [main] { pf: platform "../../../../test-platform-simple-zig/main.roc" }
|
||||
app [main] {
|
||||
pf: platform "../test-platform-simple-zig/main.roc",
|
||||
}
|
||||
|
||||
import Api { appId: "one", protocol: https } as App1
|
||||
import Api { appId: "two", protocol: http } as App2
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
app [main] {
|
||||
pf: platform "../../../../test-platform-simple-zig/main.roc",
|
||||
app [main] {
|
||||
pf: platform "../test-platform-simple-zig/main.roc",
|
||||
}
|
||||
|
||||
import Api { appId: "one", protocol: https }
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
app [main] { pf: platform "../../../../test-platform-simple-zig/main.roc" }
|
||||
app [main] {
|
||||
pf: platform "../test-platform-simple-zig/main.roc",
|
||||
}
|
||||
|
||||
import BadAnn { appId: "one" }
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
app [main] {
|
||||
pf: platform "../../../../test-platform-simple-zig/main.roc",
|
||||
pf: platform "../test-platform-simple-zig/main.roc",
|
||||
}
|
||||
|
||||
import MultilineParams {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
app [main] {
|
||||
pf: platform "../../../../test-platform-simple-zig/main.roc",
|
||||
pf: platform "../test-platform-simple-zig/main.roc",
|
||||
}
|
||||
|
||||
import Api { appId: "one", protocol: https }
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
app [main!] { pf: platform "main.roc" }
|
||||
|
||||
import pf.Effect
|
||||
|
||||
# just a stubbed app for building the test platform
|
||||
main! = \{} ->
|
||||
|
||||
Effect.putLine! ""
|
||||
|
||||
{}
|
|
@ -0,0 +1,4 @@
|
|||
app [main] { pf: platform "main.roc" }
|
||||
|
||||
main : Str
|
||||
main = "STUBBED APP"
|
|
@ -1,11 +0,0 @@
|
|||
[package]
|
||||
name = "test-platform-effects-zig"
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
version.workspace = true
|
||||
|
||||
[build-dependencies]
|
||||
roc_command_utils = { path = "../utils/command" }
|
||||
roc_test_utils_dir = { path = "../test_utils_dir" }
|
|
@ -1,35 +0,0 @@
|
|||
fn main() {
|
||||
println!("cargo:rerun-if-changed=./host.zig");
|
||||
println!("cargo:rerun-if-changed=./libhost.a");
|
||||
println!("cargo:rerun-if-changed=./host.lib");
|
||||
|
||||
roc_command_utils::zig()
|
||||
.arg("build-lib")
|
||||
.args([
|
||||
"--mod",
|
||||
&format!("glue::{}", zig_glue_path().as_path().display()),
|
||||
"--deps",
|
||||
"glue",
|
||||
"-lc", // include libc
|
||||
&format!("{}", host_path().as_path().display()),
|
||||
])
|
||||
.status()
|
||||
.expect("Failed to build the zig project");
|
||||
}
|
||||
|
||||
fn host_path() -> std::path::PathBuf {
|
||||
roc_test_utils_dir::workspace_root()
|
||||
.join("crates")
|
||||
.join("test-platform-effects-zig")
|
||||
.join("host.zig")
|
||||
}
|
||||
|
||||
fn zig_glue_path() -> std::path::PathBuf {
|
||||
roc_test_utils_dir::workspace_root()
|
||||
.join("crates")
|
||||
.join("compiler")
|
||||
.join("builtins")
|
||||
.join("bitcode")
|
||||
.join("src")
|
||||
.join("glue.zig")
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
// See build.rs, all this crate does is build the zig platform host, legacy prebuilt binary e.g. "libhost.a"
|
||||
#[allow(dead_code)]
|
||||
fn not_used() {}
|
|
@ -1,11 +0,0 @@
|
|||
[package]
|
||||
name = "test-platform-simple-zig"
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
version.workspace = true
|
||||
|
||||
[build-dependencies]
|
||||
roc_command_utils = { path = "../utils/command" }
|
||||
roc_test_utils_dir = { path = "../test_utils_dir" }
|
|
@ -1,35 +0,0 @@
|
|||
fn main() {
|
||||
println!("cargo:rerun-if-changed=./host.zig");
|
||||
println!("cargo:rerun-if-changed=./libhost.a");
|
||||
println!("cargo:rerun-if-changed=./host.lib");
|
||||
|
||||
roc_command_utils::zig()
|
||||
.arg("build-lib")
|
||||
.args([
|
||||
"--mod",
|
||||
&format!("glue::{}", zig_glue_path().as_path().display()),
|
||||
"--deps",
|
||||
"glue",
|
||||
"-lc", // include libc
|
||||
&format!("{}", host_path().as_path().display()),
|
||||
])
|
||||
.status()
|
||||
.expect("Failed to build the zig project");
|
||||
}
|
||||
|
||||
fn host_path() -> std::path::PathBuf {
|
||||
roc_test_utils_dir::workspace_root()
|
||||
.join("crates")
|
||||
.join("test-platform-simple-zig")
|
||||
.join("host.zig")
|
||||
}
|
||||
|
||||
fn zig_glue_path() -> std::path::PathBuf {
|
||||
roc_test_utils_dir::workspace_root()
|
||||
.join("crates")
|
||||
.join("compiler")
|
||||
.join("builtins")
|
||||
.join("bitcode")
|
||||
.join("src")
|
||||
.join("glue.zig")
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
// See build.rs, all this crate does is build the zig platform host, legacy prebuilt binary e.g. "libhost.a"
|
||||
#[allow(dead_code)]
|
||||
fn not_used() {}
|
Loading…
Add table
Add a link
Reference in a new issue