add recursive unions

This commit is contained in:
Folkert 2022-08-06 17:40:12 +02:00
parent 546b702740
commit be4e98e076
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 149 additions and 19 deletions

View file

@ -696,7 +696,7 @@ mod test {
}
#[test]
fn tree() {
fn nullable_tree() {
run_expect_test(
indoc!(
r#"
@ -742,4 +742,50 @@ mod test {
),
);
}
#[test]
fn recursive_tree() {
run_expect_test(
indoc!(
r#"
app "test" provides [main] to "./platform"
main = 0
Tree a : [ Leaf a, Node (Tree a) (Tree a) ]
expect
a : Tree Str
a = Leaf "Astra mortemque praestare gradatim"
b : Tree Str
b = Node (Leaf "a") (Leaf "b")
a == b
"#
),
indoc!(
r#"
This expectation failed:
7> expect
8> a : Tree Str
9> a = Leaf "Astra mortemque praestare gradatim"
10>
11> b : Tree Str
12> b = Node (Leaf "a") (Leaf "b")
13>
14> a == b
When it failed, these variables had these values:
a : Tree Str
a = Leaf "Astra mortemque praestare gradatim"
b : Tree Str
b = Node (Leaf "a") (Leaf "b")
"#
),
);
}
}