test: check and format tests for logical op chain
This commit is contained in:
parent
e14d51600f
commit
0ff64e3bac
|
@ -661,6 +661,27 @@ fn expect_sugar_incorrect_type() {
|
|||
))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn logical_op_chain_expressions_should_be_bool() {
|
||||
let source_code = r#"
|
||||
fn foo() {
|
||||
and {
|
||||
1 == 1,
|
||||
False,
|
||||
or {
|
||||
2 == 3,
|
||||
1
|
||||
}
|
||||
}
|
||||
}
|
||||
"#;
|
||||
|
||||
assert!(matches!(
|
||||
check(parse(source_code)),
|
||||
Err((_, Error::CouldNotUnify { .. }))
|
||||
))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn anonymous_function_scoping() {
|
||||
let source_code = r#"
|
||||
|
|
|
@ -20,6 +20,15 @@ fn format_simple_module() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn format_logical_op_chain() {
|
||||
assert_format!(
|
||||
r#"
|
||||
fn smth() { and { foo, bar, or { bar, foo }} }
|
||||
"#
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn format_if() {
|
||||
assert_format!(
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
source: crates/aiken-lang/src/tests/format.rs
|
||||
description: "Code:\n\nfn smth() { and { foo, bar, or { bar, foo }} }\n"
|
||||
---
|
||||
fn smth() {
|
||||
and {
|
||||
foo,
|
||||
bar,
|
||||
or {
|
||||
bar,
|
||||
foo,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue