nullable wrapped tags

This commit is contained in:
Folkert 2022-08-06 14:40:00 +02:00
parent 98e1ee1bf7
commit 546b702740
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
8 changed files with 361 additions and 10 deletions

View file

@ -336,7 +336,7 @@ mod test {
}
#[test]
fn lookup_result() {
fn lookup_copy_result() {
run_expect_test(
indoc!(
r#"
@ -375,6 +375,50 @@ mod test {
);
}
#[test]
fn lookup_clone_result() {
run_expect_test(
indoc!(
r#"
app "test" provides [main] to "./platform"
main = 0
expect
a : Result Str Str
a = Ok "foo"
b : Result Str Str
b = Err "bar"
a == b
"#
),
indoc!(
r#"
This expectation failed:
5> expect
6> a : Result Str Str
7> a = Ok "foo"
8>
9> b : Result Str Str
10> b = Err "bar"
11>
12> a == b
When it failed, these variables had these values:
a : Result Str Str
a = Ok "foo"
b : Result Str Str
b = Err "bar"
"#
),
);
}
#[test]
fn lookup_copy_record() {
run_expect_test(
@ -598,4 +642,104 @@ mod test {
),
);
}
#[test]
fn linked_list() {
run_expect_test(
indoc!(
r#"
app "test" provides [main] to "./platform"
main = 0
ConsList a : [ Nil, Cons a (ConsList a) ]
cons = \list, x -> Cons x list
expect
a : ConsList Str
a = Nil
b : ConsList Str
b = Nil
|> cons "Astra mortemque praestare gradatim"
|> cons "Profundum et fundamentum"
a == b
"#
),
indoc!(
r#"
This expectation failed:
9> expect
10> a : ConsList Str
11> a = Nil
12>
13> b : ConsList Str
14> b = Nil
15> |> cons "Astra mortemque praestare gradatim"
16> |> cons "Profundum et fundamentum"
17>
18> a == b
When it failed, these variables had these values:
a : ConsList Str
a = Nil
b : ConsList Str
b = Cons "Profundum et fundamentum" (Cons "Astra mortemque praestare gradatim" Nil)
"#
),
);
}
#[test]
fn tree() {
run_expect_test(
indoc!(
r#"
app "test" provides [main] to "./platform"
main = 0
Tree a : [ Empty, Leaf a, Node (Tree a) (Tree a) ]
cons = \list, x -> Cons x list
expect
a : Tree Str
a = Leaf "Astra mortemque praestare gradatim"
b : Tree Str
b = Node Empty Empty
a == b
"#
),
indoc!(
r#"
This expectation failed:
9> expect
10> a : Tree Str
11> a = Leaf "Astra mortemque praestare gradatim"
12>
13> b : Tree Str
14> b = Node Empty Empty
15>
16> a == b
When it failed, these variables had these values:
a : Tree Str
a = Leaf "Astra mortemque praestare gradatim"
b : Tree Str
b = Node Empty Empty
"#
),
);
}
}