add format test

Signed-off-by: KtorZ <matthias.benkort@gmail.com>
This commit is contained in:
KtorZ 2025-03-16 00:29:39 +01:00
parent b8f42dd555
commit 18d2beeadb
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
2 changed files with 42 additions and 0 deletions

View File

@ -1449,3 +1449,26 @@ fn capture_right_hand_side_assign() {
"#
);
}
#[test]
fn types_as_namespace() {
assert_format!(
r#"
use foo.{ Foo }
fn predicate(val) {
when val is {
Foo.I(n) -> n >= 14
foo.Foo.B(bytes) -> bytes == "aiken"
}
}
test my_test() {
and {
predicate(foo.Foo.I(42)),
predicate(Foo.b("aiken"))
}
}
"#
);
}

View File

@ -0,0 +1,19 @@
---
source: crates/aiken-lang/src/tests/format.rs
description: "Code:\n\nuse foo.{ Foo }\n\nfn predicate(val) {\n when val is {\n Foo.I(n) -> n >= 14\n foo.Foo.B(bytes) -> bytes == \"aiken\"\n }\n}\n\ntest my_test() {\n and {\n predicate(foo.Foo.I(42)),\n predicate(Foo.b(\"aiken\"))\n }\n}\n"
---
use foo.{Foo}
fn predicate(val) {
when val is {
Foo.I(n) -> n >= 14
foo.Foo.B(bytes) -> bytes == "aiken"
}
}
test my_test() {
and {
predicate(foo.Foo.I(42)),
predicate(Foo.b("aiken")),
}
}