Skip to content

Commit

Permalink
Test closure definition with parens around
Browse files Browse the repository at this point in the history
  • Loading branch information
kdziamura committed Jul 4, 2023
1 parent 3ccb611 commit c90c399
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
47 changes: 47 additions & 0 deletions crates/compiler/test_gen/src/gen_definitions.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#[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-wasm")]
use crate::helpers::wasm::assert_evals_to;

// use crate::helpers::with_larger_debug_stack;
//use crate::assert_wasm_evals_to as assert_evals_to;
#[allow(unused_imports)]
use indoc::indoc;
#[allow(unused_imports)]
use roc_std::{RocList, RocResult, RocStr};

#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
fn def_closure_in_parens() {
assert_evals_to!(
indoc!(
r#"
id = (\x -> x)
id 42u32
"#
),
42,
u32
);
}

#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
fn def_closure_in_multiple_parens() {
assert_evals_to!(
indoc!(
r#"
id = (((\x -> x)))
id 42u32
"#
),
42,
u32
);
}
1 change: 1 addition & 0 deletions crates/compiler/test_gen/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

pub mod gen_abilities;
pub mod gen_compare;
pub mod gen_definitions;
pub mod gen_dict;
pub mod gen_list;
pub mod gen_num;
Expand Down

0 comments on commit c90c399

Please sign in to comment.