mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 23:04:49 +00:00
Merge branch 'trunk' into use-zig-in-builtins
This commit is contained in:
commit
34aaddfe80
2 changed files with 26 additions and 12 deletions
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
|
@ -55,10 +55,9 @@ jobs:
|
||||||
name: cargo test
|
name: cargo test
|
||||||
with:
|
with:
|
||||||
command: test
|
command: test
|
||||||
args: --no-fail-fast
|
|
||||||
|
|
||||||
- uses: actions-rs/cargo@v1
|
- uses: actions-rs/cargo@v1
|
||||||
name: cargo test --release
|
name: cargo test --release
|
||||||
with:
|
with:
|
||||||
command: test
|
command: test
|
||||||
args: --release --no-fail-fast
|
args: --release
|
||||||
|
|
|
@ -13,6 +13,9 @@ mod helpers;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_mono {
|
mod test_mono {
|
||||||
use roc_collections::all::MutMap;
|
use roc_collections::all::MutMap;
|
||||||
|
use roc_module::symbol::Symbol;
|
||||||
|
use roc_mono::ir::Proc;
|
||||||
|
use roc_mono::layout::Layout;
|
||||||
|
|
||||||
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 ] imports []\n\nmain =\n");
|
let mut buffer = String::from("app Test provides [ main ] imports []\n\nmain =\n");
|
||||||
|
@ -27,15 +30,6 @@ mod test_mono {
|
||||||
buffer
|
buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE because the Show instance of module names is different in --release mode,
|
|
||||||
// these tests would all fail. In the future, when we do interesting optimizations,
|
|
||||||
// we'll likely want some tests for --release too.
|
|
||||||
#[cfg(not(debug_assertions))]
|
|
||||||
fn compiles_to_ir(_src: &str, _expected: &str) {
|
|
||||||
// just do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
fn compiles_to_ir(src: &str, expected: &str) {
|
fn compiles_to_ir(src: &str, expected: &str) {
|
||||||
use bumpalo::Bump;
|
use bumpalo::Bump;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
@ -88,8 +82,18 @@ mod test_mono {
|
||||||
assert!(mono_problems.is_empty());
|
assert!(mono_problems.is_empty());
|
||||||
|
|
||||||
debug_assert_eq!(exposed_to_host.len(), 1);
|
debug_assert_eq!(exposed_to_host.len(), 1);
|
||||||
|
|
||||||
let main_fn_symbol = exposed_to_host.keys().copied().nth(0).unwrap();
|
let main_fn_symbol = exposed_to_host.keys().copied().nth(0).unwrap();
|
||||||
|
|
||||||
|
verify_procedures(expected, procedures, main_fn_symbol);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
fn verify_procedures(
|
||||||
|
expected: &str,
|
||||||
|
procedures: MutMap<(Symbol, Layout<'_>), Proc<'_>>,
|
||||||
|
main_fn_symbol: Symbol,
|
||||||
|
) {
|
||||||
let index = procedures
|
let index = procedures
|
||||||
.keys()
|
.keys()
|
||||||
.position(|(s, _)| *s == main_fn_symbol)
|
.position(|(s, _)| *s == main_fn_symbol)
|
||||||
|
@ -120,6 +124,18 @@ mod test_mono {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE because the Show instance of module names is different in --release mode,
|
||||||
|
// these tests would all fail. In the future, when we do interesting optimizations,
|
||||||
|
// we'll likely want some tests for --release too.
|
||||||
|
#[cfg(not(debug_assertions))]
|
||||||
|
fn verify_procedures(
|
||||||
|
_expected: &str,
|
||||||
|
_procedures: MutMap<(Symbol, Layout<'_>), Proc<'_>>,
|
||||||
|
_main_fn_symbol: Symbol,
|
||||||
|
) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn ir_int_literal() {
|
fn ir_int_literal() {
|
||||||
compiles_to_ir(
|
compiles_to_ir(
|
||||||
|
@ -154,7 +170,6 @@ mod test_mono {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn ir_when_maybe() {
|
fn ir_when_maybe() {
|
||||||
compiles_to_ir(
|
compiles_to_ir(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue