Supports commenting validator inner functions.

This commit is contained in:
KtorZ
2023-03-30 13:37:09 +02:00
parent 814157dd7b
commit 5d4c95d538
2 changed files with 64 additions and 30 deletions

View File

@@ -59,18 +59,42 @@ fn test_format_if() {
fn test_format_validator() {
let src = indoc! {r#"
validator ( ) {
// What is the purpose of life
fn foo (d: Datum, r: Redeemer, ctx: ScriptContext) -> Bool {
True
}
}
// What?
validator {
/// Some documentation for foo
fn foo() {
Void
}
// I am lost
}
"#};
let expected = indoc! {r#"
validator {
// What is the purpose of life
fn foo(d: Datum, r: Redeemer, ctx: ScriptContext) -> Bool {
True
}
}
// What?
validator {
/// Some documentation for foo
fn foo() {
Void
}
// I am lost
}
"#};
assert_fmt(src, expected)
@@ -83,6 +107,7 @@ fn test_format_double_validator() {
fn foo (d: Datum, r: Redeemer, ctx: ScriptContext) -> Bool {
True
}
/// This is bar
fn bar(r: Redeemer, ctx : ScriptContext ) -> Bool { True }
}
"#};
@@ -93,6 +118,7 @@ fn test_format_double_validator() {
True
}
/// This is bar
fn bar(r: Redeemer, ctx: ScriptContext) -> Bool {
True
}