Mono and can tests for Dict.len Dict.empty

This commit is contained in:
Chadtech 2021-01-24 14:43:08 -05:00
parent ec7d8e0dc9
commit 171e0358f3
3 changed files with 45 additions and 0 deletions

View file

@ -967,6 +967,21 @@ mod test_can {
}
}
#[test]
fn dict() {
let src = indoc!(
r#"
x = Dict.empty
Dict.len x
"#
);
let arena = Bump::new();
let CanExprOut { problems, .. } = can_expr_with(&arena, test_home(), src);
assert_eq!(problems, Vec::new());
}
#[test]
fn unused_def_regression() {
let src = indoc!(

View file

@ -1264,6 +1264,7 @@ where
.stack_size(EXPANDED_STACK_SIZE)
.spawn(move |_| {
// Keep listening until we receive a Shutdown msg
for msg in worker_msg_rx.iter() {
match msg {
WorkerMsg::Shutdown => {

View file

@ -55,6 +55,7 @@ mod test_mono {
}
let exposed_types = MutMap::default();
let loaded = roc_load::file::load_and_monomorphize_from_str(
arena,
filename,
@ -633,6 +634,34 @@ mod test_mono {
)
}
#[test]
fn dict() {
compiles_to_ir(
r#"
Dict.len Dict.empty
"#,
indoc!(
r#"
procedure List.5 (#Attr.2, #Attr.3):
let Test.7 = lowlevel ListAppend #Attr.2 #Attr.3;
ret Test.7;
procedure Test.1 (Test.2):
let Test.6 = 42i64;
let Test.5 = CallByName List.5 Test.2 Test.6;
ret Test.5;
procedure Test.0 ():
let Test.8 = 1i64;
let Test.9 = 2i64;
let Test.4 = Array [Test.8, Test.9];
let Test.3 = CallByName Test.1 Test.4;
ret Test.3;
"#
),
)
}
#[test]
fn list_append_closure() {
compiles_to_ir(