fix: unable to have newline after expect bool shortcut
This commit is contained in:
parent
2ed91780f4
commit
abd18656e3
|
@ -659,8 +659,6 @@ impl<'comments> Formatter<'comments> {
|
|||
kind: AssignmentKind,
|
||||
annotation: &'a Option<Annotation>,
|
||||
) -> Document<'a> {
|
||||
self.pop_empty_lines(pattern.location().end);
|
||||
|
||||
let keyword = match kind {
|
||||
AssignmentKind::Let => "let",
|
||||
AssignmentKind::Expect => "expect",
|
||||
|
@ -673,6 +671,8 @@ impl<'comments> Formatter<'comments> {
|
|||
keyword.to_doc().append(self.case_clause_value(value))
|
||||
}
|
||||
_ => {
|
||||
self.pop_empty_lines(pattern.location().end);
|
||||
|
||||
let pattern = self.pattern(pattern);
|
||||
|
||||
let annotation = annotation
|
||||
|
|
|
@ -120,6 +120,19 @@ fn format_grouped_expression_4() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn format_preserve_newline_after_bool_expect() {
|
||||
assert_format!(
|
||||
r#"
|
||||
fn foo() {
|
||||
expect 1 == 1
|
||||
|
||||
False
|
||||
}
|
||||
"#
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn format_validator() {
|
||||
assert_format!(
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
source: crates/aiken-lang/src/tests/format.rs
|
||||
description: "Code:\n\nfn foo() {\n expect 1 == 1\n\n False\n}\n"
|
||||
---
|
||||
fn foo() {
|
||||
expect 1 == 1
|
||||
|
||||
False
|
||||
}
|
||||
|
|
@ -124,6 +124,7 @@ fn check_mint_and_outputs(
|
|||
expected_assets,
|
||||
fn(expected_asset) { expected_asset == minted_asset_name },
|
||||
)
|
||||
|
||||
expect
|
||||
list.any(
|
||||
outputs,
|
||||
|
@ -132,6 +133,7 @@ fn check_mint_and_outputs(
|
|||
datum == InlineDatum(minted_asset_name) && address.payment_credential == validator_cred
|
||||
},
|
||||
)
|
||||
|
||||
quantity == 1 && check_mint_and_outputs(
|
||||
rest_assets,
|
||||
outputs,
|
||||
|
|
Loading…
Reference in New Issue