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,
|
kind: AssignmentKind,
|
||||||
annotation: &'a Option<Annotation>,
|
annotation: &'a Option<Annotation>,
|
||||||
) -> Document<'a> {
|
) -> Document<'a> {
|
||||||
self.pop_empty_lines(pattern.location().end);
|
|
||||||
|
|
||||||
let keyword = match kind {
|
let keyword = match kind {
|
||||||
AssignmentKind::Let => "let",
|
AssignmentKind::Let => "let",
|
||||||
AssignmentKind::Expect => "expect",
|
AssignmentKind::Expect => "expect",
|
||||||
|
@ -673,6 +671,8 @@ impl<'comments> Formatter<'comments> {
|
||||||
keyword.to_doc().append(self.case_clause_value(value))
|
keyword.to_doc().append(self.case_clause_value(value))
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
self.pop_empty_lines(pattern.location().end);
|
||||||
|
|
||||||
let pattern = self.pattern(pattern);
|
let pattern = self.pattern(pattern);
|
||||||
|
|
||||||
let annotation = annotation
|
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]
|
#[test]
|
||||||
fn format_validator() {
|
fn format_validator() {
|
||||||
assert_format!(
|
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,
|
expected_assets,
|
||||||
fn(expected_asset) { expected_asset == minted_asset_name },
|
fn(expected_asset) { expected_asset == minted_asset_name },
|
||||||
)
|
)
|
||||||
|
|
||||||
expect
|
expect
|
||||||
list.any(
|
list.any(
|
||||||
outputs,
|
outputs,
|
||||||
|
@ -132,6 +133,7 @@ fn check_mint_and_outputs(
|
||||||
datum == InlineDatum(minted_asset_name) && address.payment_credential == validator_cred
|
datum == InlineDatum(minted_asset_name) && address.payment_credential == validator_cred
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
quantity == 1 && check_mint_and_outputs(
|
quantity == 1 && check_mint_and_outputs(
|
||||||
rest_assets,
|
rest_assets,
|
||||||
outputs,
|
outputs,
|
||||||
|
|
Loading…
Reference in New Issue