add format test
Signed-off-by: KtorZ <matthias.benkort@gmail.com>
This commit is contained in:
parent
b8f42dd555
commit
18d2beeadb
|
@ -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"))
|
||||
}
|
||||
}
|
||||
"#
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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")),
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue