Merge branch 'trunk' of github.com:rtfeldman/roc into wasm-runtime-error

This commit is contained in:
Brian Carroll 2022-03-07 19:16:55 +00:00
commit eaf76aa879
84 changed files with 4796 additions and 2243 deletions

View file

@ -19,7 +19,7 @@ use indoc::indoc;
use roc_std::{RocList, RocStr};
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn roc_list_construction() {
let list = RocList::from_slice(&[1i64; 23]);
assert_eq!(&list, &list);

View file

@ -11,7 +11,7 @@ use crate::helpers::wasm::{assert_evals_to, expect_runtime_error_panic};
use indoc::indoc;
#[cfg(test)]
use roc_std::RocList;
use roc_std::{RocList, RocStr};
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
@ -272,7 +272,7 @@ fn empty_record() {
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn i64_record2_literal() {
assert_evals_to!(
indoc!(
@ -299,7 +299,7 @@ fn i64_record2_literal() {
// );
// }
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn f64_record2_literal() {
assert_evals_to!(
indoc!(
@ -401,7 +401,7 @@ fn bool_literal() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn return_record() {
assert_evals_to!(
indoc!(
@ -652,7 +652,7 @@ fn optional_field_empty_record() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn return_record_2() {
assert_evals_to!(
indoc!(
@ -666,7 +666,7 @@ fn return_record_2() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn return_record_3() {
assert_evals_to!(
indoc!(
@ -680,7 +680,7 @@ fn return_record_3() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn return_record_4() {
assert_evals_to!(
indoc!(
@ -694,7 +694,7 @@ fn return_record_4() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn return_record_5() {
assert_evals_to!(
indoc!(
@ -708,7 +708,7 @@ fn return_record_5() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn return_record_6() {
assert_evals_to!(
indoc!(
@ -722,7 +722,7 @@ fn return_record_6() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn return_record_7() {
assert_evals_to!(
indoc!(
@ -792,7 +792,7 @@ fn return_record_float_float_float() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn return_nested_record() {
assert_evals_to!(
indoc!(
@ -1072,3 +1072,18 @@ fn call_with_bad_record_runtime_error() {
"#
))
}
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn generalized_accessor() {
assert_evals_to!(
indoc!(
r#"
returnFoo = .foo
returnFoo { foo: "foo" }
"#
),
RocStr::from("foo"),
RocStr
);
}

View file

@ -1,8 +1,8 @@
#[cfg(feature = "gen-llvm")]
use crate::helpers::llvm::assert_evals_to;
// #[cfg(feature = "gen-dev")]
// use crate::helpers::dev::assert_evals_to;
#[cfg(feature = "gen-dev")]
use crate::helpers::dev::assert_evals_to;
#[cfg(feature = "gen-wasm")]
use crate::helpers::wasm::assert_evals_to;
@ -29,7 +29,7 @@ fn width_and_alignment_u8_u8() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn applied_tag_nothing_ir() {
assert_evals_to!(
indoc!(
@ -49,7 +49,7 @@ fn applied_tag_nothing_ir() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn applied_tag_nothing() {
assert_evals_to!(
indoc!(
@ -69,7 +69,7 @@ fn applied_tag_nothing() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn applied_tag_just() {
assert_evals_to!(
indoc!(
@ -88,7 +88,7 @@ fn applied_tag_just() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn applied_tag_just_ir() {
assert_evals_to!(
indoc!(
@ -314,7 +314,7 @@ fn gen_if_float() {
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn when_on_nothing() {
assert_evals_to!(
indoc!(
@ -333,7 +333,7 @@ fn when_on_nothing() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn when_on_just() {
assert_evals_to!(
indoc!(
@ -352,7 +352,7 @@ fn when_on_just() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn when_on_result() {
assert_evals_to!(
indoc!(
@ -371,7 +371,7 @@ fn when_on_result() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn when_on_these() {
assert_evals_to!(
indoc!(
@ -393,7 +393,7 @@ fn when_on_these() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn match_on_two_values() {
// this will produce a Chain internally
assert_evals_to!(
@ -410,7 +410,7 @@ fn match_on_two_values() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn pair_with_underscore() {
assert_evals_to!(
indoc!(
@ -427,7 +427,7 @@ fn pair_with_underscore() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn result_with_underscore() {
// This test revealed an issue with hashing Test values
assert_evals_to!(